VB Script access denied error on WshSystemEnv (setting environment variable) Help?
I have a vbs script which sets permanent environmental variables in Vista.. I get an access denied when it tries to run the line with WshSystemEnv("test")... Does anyone know how to make this work (with UAC turned on) in Vista? Here is the code: Set WshShell = CreateObject("WScript.Shell") ' makes environment settings permanent Set WshSystemEnv = WshShell.Environment("SYSTEM") ' Set environment variable WshSystemEnv("test") = "1234" Thanks!
February 1st, 2007 7:32pm

I was able to get this to work (sortof) via a GPO and a wmi filter based on 32bit address width values: Problem I have now is this: I want to set a new variable such as ProgramFilesx86 (note the lack of parenthesis) = c:\program files if 32bit and c:\program files (x86) if 64bit.. but I need that c drive to be variable.. ie: reflect %systemdrive% instead... If I put %systemdrive% in the GPO adm template.. it just remains in that form for the environment variable value.. ie: it doesnt become C: or G: etc.. Any ideas on how to do this part? Here is the adm code that doesnt quite work with the %variable% CLASS MACHINECATEGORY "Env Variables"POLICY "Set 32BIT"KEYNAME "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"PART "ProgramFilesx86"EDITTEXTVALUENAME "ProgramFilesx86"DEFAULT "%SystemDrive%:\Program Files"END PARTEND POLICYEND CATEGORY
Free Windows Admin Tool Kit Click here and download it now
February 1st, 2007 11:24pm

Try this area as a good source of information for Programing Vista Apps http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=24&SiteID=1
February 14th, 2007 8:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics