Jump to content

RunAs different user


AMatt
 Share

Recommended Posts

I want to run an application with a  different user.

Below script works, but application is RunAs the current user, not the one provided in the script.

RunAs($sUserName, @ComputerName, $sPassword, $RUN_LOGON_NETWORK,"notepad.exe" ). 

If I use  $RUN_LOGON_PROFILE  as a parameter instead of $RUN_LOGON_NETWORK, it doesn't open the application.

Any help/guidance appreciated

Link to comment
Share on other sites

  • Moderators

Is this a local user account or a domain account? Your code works fine for a local account if I choose $RUN_LOGON_NOPROFILE

"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!

Link to comment
Share on other sites

  • Moderators

Well if it is a domain account, why are you putting the local computer as the domain? You would use your AD domain.

 

RunAs($sUserName, $sDomain, $sPassword, $RUN_LOGON_NOPROFILE, "notepad.exe" )

 

"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!

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...