Jump to content

Recommended Posts

Posted

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.

Posted

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
Posted

Try this:

If Not @UserName = "user" Then
    RunAs("user", "domain", "", 1,'"' & @ScriptDir & '\yourprogram.exe"',@ScriptName,);even tried @ScriptFullPath
EndIf
Nope no luck ;)

Well thanks, but I guess i'll just have the 1st script that runs the 2nd with run as.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...