Jump to content

Run As & @ScriptFullPath


Baraoic
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

When the words fail... music speaks.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...