AMatt Posted January 23, 2017 Share Posted January 23, 2017 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 More sharing options...
Moderators JLogan3o13 Posted January 24, 2017 Moderators Share Posted January 24, 2017 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 More sharing options...
AMatt Posted January 24, 2017 Author Share Posted January 24, 2017 Its a domain account. I want to run the application with a different domain account, like 'Run as with different user'. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 24, 2017 Moderators Share Posted January 24, 2017 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 More sharing options...
AMatt Posted January 25, 2017 Author Share Posted January 25, 2017 Thanks, it worked ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now