Baraoic Posted September 8, 2008 Posted September 8, 2008 Ok I have a question about the run as command. Why is it that when I try to do: If Not @UserName = "user" Then RunAs("user", "domain", "", 1, @ScriptName, @ScriptDir & "\");even tried @ScriptFullPath EndIf that it wont rerun the script with admin rights yet i can right click and select runas and that will run it with admin rights. I also tried making 2 scripts one that just runs the other script as admin and that did work.
Andreik Posted September 8, 2008 Posted September 8, 2008 Ok I have a question about the run as command. Why is it that when I try to do: If Not @UserName = "user" Then RunAs("user", "domain", "", 1, @ScriptName, @ScriptDir & "\");even tried @ScriptFullPath EndIf that it wont rerun the script with admin rights yet i can right click and select runas and that will run it with admin rights. I also tried making 2 scripts one that just runs the other script as admin and that did work. Try this: If Not @UserName = "user" Then RunAs("user", "domain", "", 1,'"' & @ScriptDir & '\yourprogram.exe"',@ScriptName,);even tried @ScriptFullPath EndIf
Baraoic Posted September 8, 2008 Author Posted September 8, 2008 Try this: If Not @UserName = "user" Then RunAs("user", "domain", "", 1,'"' & @ScriptDir & '\yourprogram.exe"',@ScriptName,);even tried @ScriptFullPath EndIfNope no luck Well thanks, but I guess i'll just have the 1st script that runs the 2nd with run as.
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