Jump to content

Recommended Posts

Posted

Hi everyone

 

Can any one get some idea how can i run powershell and elevate with anhoter user like this

Runas("user","domain","password",0,'PowerShell.exe') -File c:\temp\myscript-ps1 -ExecutionPolicy bypass

 

Tank you

  • Moderators
Posted

This works just fine for me. Notice I am using 2 to pass network creds

RunAs("<myAdminUserName>", "<myDomain>", "<myAdminPW>", 2, "powershell.exe -executionpolicy Bypass -File C:\Users\Me\Desktop\TestAU3.ps1")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

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