PowerShell Logo Small

New-PSSessionOption



This is the built-in help made by Microsoft for the command 'New-PSSessionOption', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates an object that contains advanced options for a PSSession.

SYNTAX


New-PSSessionOption [-ApplicationArguments <PSPrimitiveDictionary>] [-CancelTimeOut <int>] [-Culture <CultureInfo>] [-IdleTimeOut <int>] [-Maximu
mReceivedDataSizePerCommand <int>] [-MaximumReceivedObjectSize <int>] [-MaximumRedirection <int>] [-NoCompression] [-NoEncryption] [-NoMachinePro
file] [-OpenTimeOut <int>] [-OperationTimeOut <int>] [-ProxyAccessType {None | IEConfig | WinHttpConfig | AutoDetect | NoProxyServer}] [-ProxyAut
hentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-ProxyCredential <PSCredential>] [-Sk
ipCACheck] [-SkipCNCheck] [-SkipRevocationCheck] [-UICulture <CultureInfo>] [-UseUTF16] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-PSSessionOption cmdlet creates an object that contains advanced options for a PSSession. You can use the object as the value of the Sessi
onOption parameter of cmdlets that create a PSSession, such as New-PSSession, Enter-PSSession, and Invoke-Command.

Without parameters, New-PSSessionOption generates an object that contains the default values for all of the options. Because all of the propertie
s can be edited, you can use the resulting object as a template, and create standard option objects for your enterprise.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=144305
Enter-PSSession
New-PSSession
Invoke-Command

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>New-PSSessionOption


MaximumConnectionRedirectionCount : 5
NoCompression : False
NoMachineProfile : False
ProxyAccessType : IEConfig
ProxyAuthentication : Negotiate
ProxyCredential :
SkipCACheck : False
SkipCNCheck : False
SkipRevocationCheck : False
OperationTimeout : 00:03:00
NoEncryption : False
UseUTF16 : False
Culture :
UICulture :
MaximumReceivedDataSizePerCommand :
MaximumReceivedObjectSize :
ApplicationArguments :
OpenTimeout : 00:03:00
CancelTimeout : 00:01:00
IdleTimeout : 00:04:00



Description
-----------
This command creates a session option object with all of the default values.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>$pso = new-pssessionoption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB

C:\PS> new-pssession -computerName Server01 -SessionOption $pso



Description
-----------
This example shows how to use a session option object to configure a session.

The first command creates a new session option object and saves it in the value of the $pso variable.

The second command uses the New-PSSession cmdlet to create a PSSession on the Server01 remote computer. The command uses the session option objec
t in the value of the $pso variable as the value of the SessionOption parameter of the command.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>enter-pssession -computername Server01 -sessionOption (new-pssessionoption -noEncryption -noCompression)



Description
-----------
This command uses the Enter-PSSession cmdlet to start an interactive session with the Server01 computer. The value of the SessionOption parameter
is a New-PSSessionOption command with the NoEncryption and NoCompression switch parameters.

The New-PSSessionOption command is enclosed in parentheses to make sure that it runs before the Enter-PSSession command.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>$a = new-pssessionoption


MaximumConnectionRedirectionCount : 5
NoCompression : False
NoMachineProfile : False
ProxyAccessType : IEConfig
ProxyAuthentication : Negotiate
ProxyCredential :
SkipCACheck : False
SkipCNCheck : False
SkipRevocationCheck : False
OperationTimeout : 00:03:00
NoEncryption : False
UseUTF16 : False
Culture :
UICulture :
MaximumReceivedDataSizePerCommand :
MaximumReceivedObjectSize :
ApplicationArguments :
OpenTimeout : 00:03:00
CancelTimeout : 00:01:00
IdleTimeout : 00:04:00

C:\PS> $a.UICulture = (get-UICulture)
C:\PS> $a.OpenTimeout = (new-timespan -minutes 4)
C:\PS> $a.MaximumConnectionRedirectionCount = 1

C:\PS> $a

MaximumConnectionRedirectionCount : 1
NoCompression : False
NoMachineProfile : False
ProxyAccessType : IEConfig
ProxyAuthentication : Negotiate
ProxyCredential :
SkipCACheck : False
SkipCNCheck : False
SkipRevocationCheck : False
OperationTimeout : 00:03:00
NoEncryption : False
UseUTF16 : False
Culture :
UICulture : en-US
MaximumReceivedDataSizePerCommand :
MaximumReceivedObjectSize :
ApplicationArguments :
OpenTimeout : 00:04:00
CancelTimeout : 00:01:00
IdleTimeout : 00:04:00



Description
-----------
This example demonstrates that you can edit the session option object. All properties have read/write values.

Use this method to create a standard session object for your enterprise, and then create customized versions of it for particular uses.








-------------------------- EXAMPLE 5 --------------------------

C:\PS>$PSSessionOption = New-PSSessionOption -OpenTimeOut 120000



Description
-----------
This command creates a $PSSessionOption preference variable.

When the $PSSessionOption preference variable exists in the session, it establishes default values for options in the PSSessions that are created
by using the New-PSSession, Enter-PSSession, and Invoke-Command cmdlets.

To make the $PSSessionOption variable available in all sessions, add it to your Windows PowerShell session and to your Windows PowerShell profile
.

For more information about the $PSSessionOption variable, see about_Preference_Variables. For more information about profiles, see about_Profiles
.








-------------------------- EXAMPLE 6 --------------------------

C:\PS>$skipCN = new-pssessionoption -SkipCNCheck

C:\PS> new-pssession -computername 171.09.21.207 -UseSSL -credential domain01\user01 -sessionOption $skipCN



Description
-----------
This example shows how to use a SessionOption object to fulfill the requirements for a remote session configuration.

The first command uses the New-PSSessionOption cmdlet to create a session option object with the SkipCNCheck property. The command saves the resu
lting session object in the $skipCN variable.

The second command uses the New-PSSession cmdlet to create a new PSSession on a remote computer. The $skipCN check variable is used in the value
of the SessionOption parameter.

Because the computer is identified by its IP address, the value of the ComputerName parameter does not match any of the common names in the certi
ficate used for Secure Sockets Layer (SSL). As a result, the SkipCNCheck option is required.