wosteen Posted March 2, 2011 Share Posted March 2, 2011 I have a question regarding the use of RunAs under Windows 7. Until recently, we've been a completely WinXP SP3 shop. I've used the following code (flawlessly) to make a script run itself with elevated privileges: RunAs($USERNAME,$DOMAIN,$PASSWORD,0,@ComSpec & " /c " & Chr(34) & @ScriptFullPath & Chr(34),@TempDir,@SW_HIDE) If @error Then MsgBox(4096+32,@Error, "Error starting under admin mode") Under Windows 7, this process no longer functions, ending with @Error = 1. After much hair-pulling and experimentation, I finally got it to work under 7 by changing the logon_flag from 0 to 4. I'm afraid I don't really understand what this does, only that it worked... mostly. This seems to work fine on 32-bit Win7. However, if I run it on 64-bit Win7, I get the same results as before... failure with @Error = 1. No matter what I set the flag to, I get the same results. I've tried compiling the script as 32 bit and also 64 bit with no differences. Any ideas where this might be going wrong? Thanks in advance! Wayne Link to comment Share on other sites More sharing options...
wosteen Posted March 3, 2011 Author Share Posted March 3, 2011 /bump back to front page Link to comment Share on other sites More sharing options...
AndrewChapman Posted July 28, 2011 Share Posted July 28, 2011 Did you ever get this to work? I have run into exactly the same problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now