PowerShell Logo Small

New-PSTransportOption



This is the built-in help made by Microsoft for the command 'New-PSTransportOption', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' 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 session configuration.

SYNTAX


New-PSTransportOption [-IdleTimeoutSec [<Int32]>]] [-MaxConcurrentCommandsPerSession [<Int32]>]] [-MaxConcurrentUsers [<Int32]>]] [-MaxIdleTimeoutSec [<Int32]>]]
[-MaxMemoryPerSessionMB [<Int32]>]] [-MaxProcessesPerSession [<Int32]>]] [-MaxSessions [<Int32]>]] [-MaxSessionsPerUser [<Int32]>]] [-OutputBufferingMode
[<OutputBufferingMode]>]] [-ProcessIdleTimeoutSec [<Int32]>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-PSTransportOption cmdlet creates an object that contains transport options for session configurations. You can use the object as the value of the TransportOption
parameter of cmdlets that create or change a session configuration, such as the Register-PSSessionConfiguration and Set-PSSessionConfiguration cmdlets.


You can also change the transport option settings by editing the values of the session configuration properties in the WSMan: drive. For more information, see WSMan Provider.


The session configuration options represent the session values set on the "server-side," or receiving end of a remote connection. The "client-side," or sending end of the
connection, can set session option values when the session is created, or when the client disconnects from or reconnects to the session. Unless stated otherwise, when the
setting values conflict, the client-side values take precedence. However, the client-side values cannot violate maximum values and quotas set in the session configuration.


Without parameters, New-PSTransportOption generates a transport option object with null values for all of the options. If you omit a parameter, the object has a null value
for the property that the parameter represents. A null value has no effect on the session configuration.


For more information about session options, see New-PSSessionOption. For more information about session configurations, see about_Session_Configurations
(http://go.microsoft.com/fwlink/?LinkID=145152).


This cmdlet is introduced in Windows PowerShell 3.0.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=289599
about_Session_Configurations
New-PSSession
New-PSSessionOption
Register-PSSessionConfiguration
Set-PSSessionConfiguration

REMARKS

<

Examples


Example 1

PS C:\>New-PSTransportOption
ProcessIdleTimeoutSec :
MaxIdleTimeoutSec :
MaxSessions :
MaxConcurrentCommandsPerSession :
MaxSessionsPerUser :
MaxMemoryPerSessionMB :
MaxProcessesPerSession :
MaxConcurrentUsers :
IdleTimeoutSec :
OutputBufferingMode :



This command runs the New-PSTransportOption with no parameters. The output shows that the cmdlet generates a transport option object with null values for all properties.






Example 2

The first command uses the New-PSTransportOption cmdlet to create a transport options object, which it saves in the $t variable. The command uses the MaxSessions parameter
to increase the maximum number of sessions to 40.
PS C:\>$t = New-PSTransportOption -MaxSessions 40

The second command uses the Register-PSSessionConfiguration cmdlet create the ITTasks session configuration. The command uses the TransportOption parameter to specify the
transport options object in the $t variable.
PS C:\>Register-PSSessionConfiguration -Name ITTaska -TransportOption $t

The third command uses the Get-PSSessionConfiguration cmdlet to get the ITTasks session configurations and the Format-List cmdlet to display all of the properties of the
session configuration object in a list. The output shows that the value of the MaxShells property of the session configuration is 40.
PS C:\>Get-PSSessionConfiguration -Name ITTasks | Format-List -Property *
Architecture : 64
Filename : %windir%\system32\pwrshplugin.dll
ResourceUri : http://schemas.microsoft.com/powershell/ITTasks
MaxConcurrentCommandsPerShell : 1000
UseSharedProcess : false
ProcessIdleTimeoutSec : 0
xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
MaxConcurrentUsers : 5
lang : en-US
SupportsOptions : true
ExactMatch : true
RunAsUser :
IdleTimeoutms : 7200000
PSVersion : 3.0
OutputBufferingMode : Block
AutoRestart : false
MaxShells : 40
MaxMemoryPerShellMB : 1024
MaxIdleTimeoutms : 43200000
SDKVersion : 2
Name : ITTasks
XmlRenderingType : text
Capability : {Shell}
RunAsPassword :
MaxProcessesPerShell : 15
Enabled : True
MaxShellsPerUser : 25
Permission :



This example shows how to use a transport options object to set session configuration options






Example 3

The first command uses the New-PSTransportOption cmdlet to create a transport option object. The command uses the IdleTimeoutSec parameter to set the IdleTimeoutSec property
value of the object to one hour (3600 seconds). The command saves the transport objects object in the $t variable.
PS C:\>$t = New-PSTransportOption -IdleTimeoutSec 3600

The second command uses the Set-PSSessionConfiguration cmdlet to change the transport options of the ITTasks session configuration. The command uses the TransportOption
parameter to specify the transport options object in the $t variable.
PS C:\>Set-PSSessionConfiguration -Name ITTasks -TransportOption $t

The third command uses the New-PSSession cmdlet to create the MyITTasks session on the local computer. The command uses the ConfigurationName property to specify the ITTasks
session configuration. The command saves the session in the $s variable.Notice that the command does not use the SessionOption parameter of New-PSSession to set a custom
idle timeout for the session. If it did, the idle timeout value set in the session option would take precedence over the idle timeout set in the session configuration.
PS C:\>$s = New-PSSession -Name MyITTasks -ConfigurationName ITTasks

The fourth command uses the Format-List cmdlet to display all properties of the session in the $s variable in a list. The output shows that the session has an idle timeout
of one hour (360,000 milliseconds).
PS C:\>$s | Format-List -Property *
State : Opened
IdleTimeout : 3600000
OutputBufferingMode : Block
ComputerName : localhost
ConfigurationName : ITTasks
InstanceId : 4110c3f5-68ea-40fa-9bbf-04a433dbb02d
Id : 1
Name : MyITTasks
Availability : Available
ApplicationPrivateData : {PSVersionTable}
Runspace : System.Management.Automation.RemoteRunspace



This command shows the effect of setting a transport option in a session configuration on the sessions that use the session configuration.