Posts Tagged ‘poweshell’

Creating remote powershell session

Monday, November 25th, 2013

Simply enter the command

Enter-PSSession –ComputerName <computer name>

This will let you control a single computer remotely, if you want to control more than one computer simultaneously then enter a command similar to the below

Invoke-Command -ScriptBlock { Get-EventLog System -Newest 5 } -Computername compname1,compname2,compname3

Where the command between the braces is the command you would like to run against the remote servers

Don’t forget, you can still enter commands against a remote computer with WinRM enabled (it’s enabled by default in Windows 2012) by entering the command:

winrs -r:<servername> <command to run>

<command to run> could even be powershell.exe to create a remote powershell session !