다음을 통해 공유


New-PSTransportOption

세션 구성에 대한 고급 옵션을 포함하는 개체를 만듭니다.

구문

Default (기본값)

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

Description

New-PSTransportOption cmdlet은 세션 구성에 대한 전송 옵션을 포함하는 개체를 만듭니다. Register-PSSessionConfiguration 및 Set-PSSessionConfiguration cmdlet과 같은 세션 구성을 만들거나 변경하는 cmdlet의 TransportOption 매개 변수 값으로 개체를 사용할 수 있습니다.

WSMan: 드라이브에서 세션 구성 속성의 값을 편집하여 전송 옵션 설정을 변경할 수도 있습니다. 자세한 내용은 WSMan 공급자를 참조하세요.

세션 구성 옵션은 서버 쪽에서 설정되거나 원격 연결의 끝을 수신하는 세션 값을 나타냅니다. 클라이언트 측, 즉 연결의 전송 측은 세션이 생성될 때 또는 클라이언트가 세션에서 연결을 끊거나 다시 연결할 때 세션 옵션 값을 설정할 수 있습니다. 달리 명시하지 않는 한 설정 값이 충돌하면 클라이언트 쪽 값이 우선합니다. 그러나 클라이언트 쪽 값은 세션 구성에 설정된 최대 값 및 할당량을 위반할 수 없습니다.

매개 변수가 없으면 New-PSTransportOption 모든 옵션에 대해 null 값이 있는 전송 옵션 개체를 생성합니다. 매개 변수를 생략하면 개체에 매개 변수가 나타내는 속성에 대한 null 값이 있습니다. null 값은 세션 구성에 영향을 주지 않습니다.

세션 옵션에 대한 자세한 내용은 New-PSSessionOption을 참조하세요. 세션 구성에 대한 자세한 내용은 about_Session_Configurations참조하세요.

이 cmdlet은 Windows PowerShell 3.0에서 도입되었습니다.

예제

예제 1: 기본 전송 옵션 생성

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

이 명령은 매개 변수 없이 New-PSTransportOption 실행합니다. 출력은 cmdlet이 모든 속성에 대해 null 값을 가진 전송 옵션 개체를 생성한다는 것을 보여 줍니다.

예제 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 ITTasks -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                   : https://schemas.microsoft.com/powershell/ITTasks
MaxConcurrentCommandsPerShell : 1000
UseSharedProcess              : false
ProcessIdleTimeoutSec         : 0
xmlns                         : https://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                    :

이 예제에서는 전송 옵션 개체를 사용하여 세션 구성 옵션을 설정하는 방법을 보여줍니다.

예제 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 time-out for the session. If it did, the idle time-out value set in the session option would take precedence over the idle time-out 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 time-out 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

이 명령은 세션 구성을 사용하는 세션에서 세션 구성에서 전송 옵션을 설정하는 효과를 보여 줍니다.

매개 변수

-IdleTimeoutSec

원격 컴퓨터가 로컬 컴퓨터에서 통신을 받지 못하는 경우 각 세션이 열린 상태로 유지되는 기간을 결정합니다. 여기에는 하트비트 신호가 포함됩니다. 간격이 만료되면 세션이 닫힙니다.

유휴 시간 제한 값은 사용자가 세션의 연결을 끊고 다시 연결하려는 경우 매우 중요합니다. 세션 시간이 초과되지 않은 경우에만 사용자가 다시 연결할 수 있습니다.

IdleTimeoutSec 매개 변수는 세션 구성의 IdleTimeoutMs 속성에 해당합니다.

값을 초 단위로 입력합니다. 기본값은 7200(2시간)입니다. 최소값은 60(1분)입니다. 최대값은 WSMan 구성()에 있는 Shell 개체의 WSMan:\\\<ComputerName\>\Shell\IdleTimeout 속성 값입니다. 기본값은 7200000밀리초(2시간)입니다.

세션 옵션 및 세션 구성에서 유휴 시간 제한 값이 설정된 경우 세션 옵션에서 설정된 값이 우선하지만 세션 구성의 MaxIdleTimeoutMs 속성 값을 초과할 수 없습니다. MaxIdleTimeoutMs 속성의 값을 설정하려면 MaxIdleTimeoutSec 매개 변수를 사용합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxConcurrentCommandsPerSession

각 세션에서 동시에 실행할 수 있는 명령 수를 지정된 값으로 제한합니다. 기본값은 1000입니다.

MaxConcurrentCommandsPerSession 매개 변수는 세션 구성의 MaxConcurrentCommandsPerShell 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxConcurrentUsers

각 세션에서 동시에 명령을 실행할 수 있는 사용자 수를 지정된 값으로 제한합니다. 기본값은 5입니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxIdleTimeoutSec

각 세션의 유휴 세션 시간 제한을 지정된 값으로 설정합니다. 기본값은 [Int]::MaxValue(~25일)입니다.

유휴 시간 제한 값은 사용자가 세션의 연결을 끊고 다시 연결하려는 경우 매우 중요합니다. 세션 시간이 초과되지 않은 경우에만 사용자가 다시 연결할 수 있습니다.

MaxIdleTimeoutSec 매개 변수는 세션 구성의 MaxIdleTimeoutMs 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxMemoryPerSessionMB

각 세션에서 사용하는 메모리를 지정된 값으로 제한합니다. 값을 메가바이트 단위로 입력합니다. 기본값은 1024MB(1GB)입니다.

MaxMemoryPerSessionMB 매개 변수는 세션 구성의 MaxMemoryPerShellMB 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxProcessesPerSession

각 세션에서 실행되는 프로세스 수를 지정된 값으로 제한합니다. 기본값은 15입니다.

MaxProcessesPerSession 매개 변수는 세션 구성의 MaxProcessesPerShell 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxSessions

세션 구성을 사용하는 세션 수를 제한합니다. 기본값은 25입니다.

MaxSessions 매개 변수는 세션 구성의 MaxShells 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-MaxSessionsPerUser

세션 구성을 사용하고 지정된 사용자의 자격 증명으로 실행하는 세션 수를 지정된 값으로 제한합니다. 기본값은 25입니다.

이 값을 지정할 때 많은 사용자가 실행의 자격 증명을 사용자로 사용할 수 있음을 고려합니다.

MaxSessionsPerUser 매개 변수는 세션 구성의 MaxShellsPerUser 속성에 해당합니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-OutputBufferingMode

출력 버퍼가 가득 차면 연결이 끊긴 세션에서 명령 출력을 관리하는 방법을 결정합니다. 이 매개 변수에 허용되는 값은 다음과 같습니다.

  • 차단. 출력 버퍼가 가득 차면 버퍼가 명확할 때까지 실행이 일시 중단됩니다.
  • 방울. 출력 버퍼가 가득 차면 실행이 계속됩니다. 새 출력이 저장되면 가장 오래된 출력이 삭제됩니다.
  • 없음. 출력 버퍼링 모드가 지정되지 않았습니다.

세션의 OutputBufferingMode 속성의 기본값은 Block입니다.

매개 변수 속성

형식:OutputBufferingMode
Default value:None
허용되는 값:None, Drop, Block
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-ProcessIdleTimeoutSec

각 호스트 프로세스의 제한 시간을 지정된 값으로 제한합니다. 기본값 0은 프로세스에 대한 제한 시간 값이 없음을 의미합니다.

다른 세션 구성에는 프로세스별 제한 시간 값이 있습니다. 예를 들어 Microsoft.PowerShell.Workflow 세션 구성의 프로세스별 제한 시간 값은 28800초(8시간)입니다.

매개 변수 속성

형식:Int32
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

CommonParameters

이 cmdlet은 일반적인 매개 변수인 -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction 및 -WarningVariable 매개 변수를 지원합니다. 자세한 내용은 about_CommonParameters를 참조하세요.

입력

None

이 cmdlet에 입력을 파이프할 수 없습니다.

출력

WSManConfigurationOption

참고

  • 세션 구성 개체의 속성은 세션 구성에 대해 설정된 옵션 및 해당 옵션의 값에 따라 달라집니다. 또한 세션 구성 파일을 사용하는 세션 구성에는 추가 속성이 있습니다.