Sign in to follow this  
Followers 0
AMatt

RunAs different user

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Its a domain account. I want to run the application with a different domain account, like 'Run as with different user'.

Share this post


Link to post
Share on other sites

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

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Thanks, it worked ! 

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