Sign in to follow this  
Followers 0
Baraoic

Run As & @ScriptFullPath

3 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0