acousticirisblog: I just need to leave your lunch.

30 October 2006

CScript Error: Loading your settings failed. (Access is Denied.)

Write something using Windows technology and expect it will work. That's the philosophy I took, anyway. It turns out, this is not always true (I know, we're all so surprised). While converting a series of Perl scripts to SQL scripts launched via small VBS files, I ran into this on a test box.

Here's the things to check:
Fire up Regedit (Windows Server 2003) or Regedt32 (Windows 2000 Server)
Registry Keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings
HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings

Make sure that you have both of those keys and that the permissions are set ensuring that the ID you're using to execute CSCRIPT can read them.
If you're on Server 2K3, right-click the key and choose "Permissions"
If you're on Windows 2000 Server, click "Permissions..." at the top of the window after clicking the key.

Didn't work?

Check out the same HKEY_LOCAL_MACHINE key and look for

DWORD TrustPolicy

If it's not present, add it and set the value to "0". Note that in doing so, you're allowing CScript to run any script called (approved/unapproved without prompting).
Don't do this unless you are sure it won't pose a security risk to the server/workstation you're trying to "fix".

Have fun!
.ai