PowerShell 2.0: One Cmdlet at a Time 31 Enter-PSSession
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Enter-PSSession cmdlet.
What can I do with it?
Open an interactive PowerShell session with a computer which has been enabled for PowerShell remoting.
Example:
Open a session with the server Test01 and see which services begin with the letter T.
Enter-PSSession -ComputerName Test01 Get-Service | Where-Object {$_.name -like ‘T*’}
You will notice that the prompt has changed to
[test01]: PS C:\>
which helpfully shows you which server you are running the remote session on.
How could I have done this in PowerShell 1.0?
Remoting did not exist in PowerShell 1.0, you would have needed to use Remote Desktop to run an interactive session on a remote server.