Jump to content
Sign in to follow this  
Baraoic

Run As & @ScriptFullPath

Recommended Posts

Baraoic

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
Andreik

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
Baraoic

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.