Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #35 New-PSSessionOption

    Posted on January 11th, 2010 Jonathan Medd No comments

    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

    New-PSSessionOption1

    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.

    New-PSSessionOption2

    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.

    1000 things 1% better!

    Leave a reply