PowerShell 2.0: One Cmdlet at a Time 35 New-PSSessionOption
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-PSSessionOption cmdlet.
What can I do with it?
Create a new object with advanced session settings to be used when opening PowerShell remote sessions.
Examples:
Show the possible options which can be set with New-PSSessionOption
New-PSSessionOption
Set some advanced session options via the $sessionoptions variable and use them to make a remote PowerShell connection.
$sessionoptions = New-PSSessionOption -IdleTimeout 600000 -NoCompression -NoMachineProfile New-PSSession -ComputerName Test01 -SessionOption $sessionoptions
Notice the difference from the default in the options which have been set.
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.