We execute a script from a webservice that does some actions in VBScript. This script runs from the command line without an error. When we run this script from a service with ProcessStartInfo it does not execute when the user the process is running in is not logged in. We get this error: CScript Error: Loading your settings failed. (Access is denied. ) Though, when the user that executes the service is logged in via remote desktop, the service is running successfully. What could cause this and how could we solve this?
Share
What user identity is the VBScript being run under when you get the “Access is denied” message? I’ll bet it’s
NT AUTHORITY\NETWORK SERVICE, which might explain it.When you run anything when logged-in by cmd or double-clicking in Explorer then the process runs under the user identity (security context) of the current user. When you’re running it outside of a local console session (such as a service session) then it usually runs under the user identity of the parent service process.
By “service” are you referring to a Windows Service (what you see in Services.msc) or your web-service? If it’s a web-service then it’s run under the user identity of the current IIS Application Pool.
Try running “whoami” (it’s a command-line program) from your web-service script and have it redirect the console output to a file. That will tell you the current user identity you’re using.