If you're trying to impersonate a Windows identity in an Excel Services UDF, make sure to configure the Excel Service access mode to delegation, rather than the Trusted Subsystem model (default). This can be done with the following commands: stsadm -o set-ecssecurity -accessmodel delegation -ssp sspname stsadm -o execadmsvcjobs iisreset Failing to do so could result in hours of frustration! Specifically, if you always go down the error path in the following code, this is likely the problem: if ((wi ......