Create Remote PowerShell Session As Different User

Create a remote session of PowerShell as a different user.

John Savill

July 26, 2014

1 Min Read
PowerShell command prompt

Q: How can I create a PowerShell session to a remote machine as a different user?

A: There are several ways to create a PowerShell session to a remote machine as a different user. The following code requests the credentials you want to use and then creates and connects remotely to the machine where you can run commands:

$cred=Get-Credential$sess = New-PSSession -Credential $cred -ComputerName Enter-PSSession $sessExit-PSSessionRemove-PSSession $sess

When you're finished, type Exit-PSSession and then remove the session.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like