Get-PSSessionConfiguration

컴퓨터에 등록된 세션 구성을 가져옵니다.

Syntax

Get-PSSessionConfiguration
   [[-Name] <String[]>]
   [-Force]
   [<CommonParameters>]

Description

cmdlet은 Get-PSSessionConfiguration 로컬 컴퓨터에 등록된 세션 구성을 가져옵니다. 이 cmdlet은 시스템 관리자가 사용자에 대한 사용자 지정 세션을 관리하는 데 사용할 수 있는 고급 cmdlet입니다.

PowerShell 3.0부터 세션 구성(.pssc) 파일을 사용하여 세션 구성의 속성을 정의할 수 있습니다. 이 기능을 사용하면 컴퓨터 프로그램을 작성하지 않고도 사용자 지정 및 제한된 세션을 만들 수 있습니다. 세션 구성 파일에 대한 자세한 내용은 about_Session_Configuration_Files 참조하세요.

또한 PowerShell 3.0부터 새 메모 속성이 반환되는 Get-PSSessionConfiguration 세션 구성 개체에 추가되었습니다. 이러한 속성을 사용하면 사용자 및 세션 구성 작성자가 세션 구성을 더 쉽게 검사하고 비교할 수 있습니다.

세션 구성을 만들고 등록하려면 cmdlet을 Register-PSSessionConfiguration 사용합니다. 세션 구성에 대한 자세한 내용은 about_Session_Configurations를 참조하세요.

예제

예제 1 - 로컬 컴퓨터에서 세션 구성 가져오기

Get-PSSessionConfiguration

예제 2 - 두 개의 기본 세션 구성 가져오기

이 명령은 Name 매개 변수 Get-PSSessionConfiguration사용하여 "Microsoft"로 시작하는 이름의 세션 구성만 가져옵니다.

Get-PSSessionConfiguration -Name Microsoft*

Name                      PSVersion  StartupScript        Permission
----                      ---------  -------------        ----------
microsoft.powershell      5.1                             BUILTIN\Administrators AccessAll...
microsoft.powershell32    5.1                             BUILTIN\Administrators AccessAll...

예제 3 - 세션 구성의 속성 및 값 가져오기

이 예제에서는 세션 구성 파일을 사용하여 만든 세션 구성의 속성 및 속성 값을 표시합니다.

Get-PSSessionConfiguration -Name Full  | Format-List -Property *

Copyright                     : (c) 2011 User01. All rights reserved.
AliasDefinitions              : {System.Collections.Hashtable}
SessionType                   : Default
CompanyName                   : Unknown
GUID                          : 1e9cb265-dae0-4bd3-89a9-8338a47698a1
Author                        : User01
ExecutionPolicy               : Restricted
SchemaVersion                 : 1.0.0.0
LanguageMode                  : FullLanguage
Architecture                  : 64
Filename                      : %windir%\system32\pwrshplugin.dll
ResourceUri                   : http://schemas.microsoft.com/powershell/Full
MaxConcurrentCommandsPerShell : 1500
UseSharedProcess              : false
ProcessIdleTimeoutSec         : 0
xmlns                         : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
MaxConcurrentUsers            : 10
lang                          : en-US
SupportsOptions               : true
ExactMatch                    : true
configfilepath                : C:\WINDOWS\System32\WindowsPowerShell\v1.0\SessionConfig\Full_1e9cb265-dae0-4bd3-89a9-8338a47698a1.pssc
RunAsUser                     :
IdleTimeoutms                 : 7200000
PSVersion                     : 3.0
OutputBufferingMode           : Block
AutoRestart                   : false
MaxShells                     : 300
MaxMemoryPerShellMB           : 1024
MaxIdleTimeoutms              : 43200000
SDKVersion                    : 1
Name                          : Full
XmlRenderingType              : text
Capability                    : {Shell}
RunAsPassword                 :
MaxProcessesPerShell          : 25
Enabled                       : True
MaxShellsPerUser              : 30
Permission                    :

이 예제에서는 cmdlet을 Get-PSSessionConfiguration 사용하여 전체 세션 구성을 가져옵니다. 파이프라인 연산자는 전체 세션 구성을 cmdlet으로 Format-List 보냅니다. 값 * 이 모두인 Property 매개 변수는 목록에 있는 개체의 모든 속성과 값을 표시하도록 지시 Format-List 합니다.

출력에는 세션 구성 작성자, 세션 유형, 언어 모드 및 이 세션 구성, 세션 할당량 및 세션 구성 파일의 전체 경로로 만든 세션의 실행 정책을 비롯한 유용한 정보가 포함됩니다.

세션 구성의 이 보기는 세션 구성 파일을 포함하는 세션에 사용됩니다. 세션 구성 파일에 대한 자세한 내용은 about_Session_Configuration_Files 참조하세요.

예제 4 - 세션 구성을 보는 또 다른 방법

이 예제에서는 WSMan: 공급자 드라이브의 cmdlet(별칭dir)을 사용하여 Get-ChildItem 플러그 인 노드의 콘텐츠를 확인합니다. 이는 컴퓨터의 세션 구성을 살펴보는 또 다른 방법입니다.

dir wsman:\localhost\plugin

Type            Keys                                Name
----            ----                                ----
Container       {Name=Event Forwarding Plugin}      Event Forwarding Plugin
Container       {Name=Full}                         Full
Container       {Name=microsoft.powershell}         microsoft.powershell
Container       {Name=microsoft.powershell.workf... microsoft.powershell.workflow
Container       {Name=microsoft.powershell32}       microsoft.powershell32
Container       {Name=microsoft.ServerManager}      microsoft.ServerManager
Container       {Name=WMI Provider}                 WMI Provider

PlugIn 노드에는 등록된 PowerShell 세션 구성을 나타내는 ContainerElement 개체(Microsoft.WSMan.Management.WSManConfigContainerElement)와 WS-Management용 다른 플러그 인이 포함되어 있습니다.

예제 6 - 원격 컴퓨터에서 세션 구성 보기

이 예제에서는 WSMan 공급자를 사용하여 원격 컴퓨터에서 세션 구성을 보는 방법을 보여 줍니다. 이 메서드는 명령만큼 Get-PSSessionConfiguration 많은 정보를 제공하지 않지만 사용자가 이 cmdlet을 실행하기 위해 관리istrators 그룹의 멤버일 필요는 없습니다.

Connect-WSMan -ComputerName Server01
dir WSMan:\Server01\Plugin

WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin

Type            Keys                                Name
----            ----                                ----
Container       {Name=Empty}                        Empty
Container       {Name=Event Forwarding Plugin}      Event Forwarding Plugin
Container       {Name=Full}                         Full
Container       {Name=microsoft.powershell}         microsoft.powershell
Container       {Name=microsoft.powershell.workf... microsoft.powershell.workflow
Container       {Name=microsoft.powershell32}       microsoft.powershell32
Container       {Name=microsoft.ServerManager}      microsoft.ServerManager
Container       {Name=NoLanguage}                   NoLanguage
Container       {Name=RestrictedLang}               RestrictedLang
Container       {Name=RRS}                          RRS
Container       {Name=SEL Plugin}                   SEL Plugin
Container       {Name=WithProfile}                  WithProfile
Container       {Name=WMI Provider}                 WMI Provider

cmdlet은 Connect-WSMan Server01 원격 컴퓨터의 WinRM 서비스에 연결합니다. WSMan: 드라이브의 cmdlet(별칭)은 Get-ChildItem Server01\Plugin 경로의 항목을 dir가져옵니다. 출력에는 Server01 컴퓨터의 플러그 인 디렉터리에 있는 항목이 표시됩니다. 항목에는 WSMan 플러그 인의 형식인 세션 구성과 컴퓨터의 다른 유형의 플러그 인이 포함됩니다.

예제 7 - 원격 컴퓨터에서 자세한 세션 구성 가져오기

이 예제에서는 원격 컴퓨터에서 Get-PSSessionConfiguration 명령을 실행하는 방법을 보여줍니다. 이 명령을 사용하려면 로컬 컴퓨터의 클라이언트 설정 및 원격 컴퓨터의 서비스 설정에서 CredSSP 위임을 사용하도록 설정해야 합니다.

이 예제에서 명령을 실행하려면 로컬 및 원격 컴퓨터에서 관리istrators 그룹의 구성원이어야 하며 관리자 권한으로 실행 옵션을 사용하여 PowerShell을 시작해야 합니다.

Enable-WSManCredSSP -Delegate Server02
Connect-WSMan Server02
Set-Item WSMan:\Server02*\Service\Auth\CredSSP -Value $true
Invoke-Command -ScriptBlock {Get-PSSessionConfiguration} -ComputerName Server02 -Authentication CredSSP -Credential Domain01\Admin01

Name                      PSVersion  StartupScript        Permission                          PSComputerName
----                      ---------  -------------        ----------                          --------------
microsoft.powershell      5.1                             BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com
microsoft.powershell32    5.1                             BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com
MyX86Shell                5.1        c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com

이 cmdlet은 Enable-WSManCredSSP로컬 컴퓨터인 Server01에서 CredSSP 위임을 사용하도록 설정합니다. cmdlet은 Connect-WSMan Server02 컴퓨터에 연결합니다. 이 작업은 서버02용 노드를 로컬 컴퓨터의 WSMan: 드라이브에 추가하여 Server02 컴퓨터에서 WS-Management 설정을 보고 변경할 수 있습니다. 이 cmdlet은 Set-Item Server02 컴퓨터의 서비스 노드에 있는 CredSSP 항목의 값을 True변경합니다. 이렇게 하면 원격 컴퓨터에서 서비스 설정이 구성됩니다. cmdlet은 Invoke-Command Server02 컴퓨터에서 명령을 실행Get-PSSessionConfiguration 합니다. 이 명령은 자격 증명 매개 변수를 사용하며 CredSSP과 함께 Authentication 매개 변수를 사용합니다. 출력은 Server02 원격 컴퓨터의 세션 구성을 보여 줍니다.

예제 8 - 세션 구성의 리소스 URI 가져오기

이 예제는 리소스 URI를 사용하는 기본 설정 변수의 $PSSessionConfigurationName 값을 설정하는 데 유용합니다.

(Get-PSSessionConfiguration -Name CustomShell).resourceURI

http://schemas.microsoft.com/powershell/microsoft.CustomShell

이 변수는 $PSSessionConfigurationName 세션을 만들 때 사용되는 기본 구성을 지정합니다. 이 변수는 로컬 컴퓨터에서 설정되지만 원격 컴퓨터에서 구성을 지정합니다. 변수에 대한 $PSSessionConfiguration 자세한 내용은 about_Preference_Variables 참조하세요.

매개 변수

-Force

서비스가 아직 실행되고 있지 않은 경우 WinRM 서비스를 다시 시작하라는 프롬프트를 표시하지 않습니다.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

지정된 이름이나 이름 패턴의 세션 구성만 가져옵니다. 하나 이상의 세션 구성 이름을 입력합니다. 야생카드 허용됩니다.

Type:String[]
Position:0
Default value:All session configurations on the local computer
Required:False
Accept pipeline input:False
Accept wildcard characters:True

입력

None

개체를 이 cmdlet으로 파이프할 수 없습니다.

출력

Microsoft.PowerShell.Commands.PSSessionConfigurationCommands

참고

  • 이 cmdlet을 실행하려면 관리자 권한으로 실행 옵션을 사용하여 PowerShell을 시작합니다.

  • 컴퓨터에서 세션 구성을 보려면 컴퓨터의 관리istrators 그룹의 구성원이어야 합니다.

  • 원격 컴퓨터에서 Get-PSSessionConfiguration 명령을 실행하려면 로컬 컴퓨터의 클라이언트 설정(cmdlet 사용 Enable-WSManCredSSP ) 및 원격 컴퓨터의 서비스 설정에서 CredSSP(자격 증명 보안 서비스 공급자) 인증을 사용하도록 설정해야 합니다. 또한 원격 세션을 설정할 때 인증 매개 변수의 CredSSP 값을 사용해야 합니다. 그러지 않으면 액세스가 거부됩니다.

  • 반환되는 Get-PSSessionConfiguration 개체의 note 속성은 값이 있는 경우에만 개체에 표시됩니다. 세션 구성 파일을 사용하여 만든 세션 구성에만 정의된 모든 속성이 있습니다.

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

  • WSMan: 드라이브에서 명령을 사용하여 세션 구성의 속성을 변경할 수 있습니다. 그러나 PowerShell 2.0의 WSMan: 드라이브를 사용하여 OutputBufferingMode와 같은 PowerShell 3.0에 도입된 세션 구성 속성을 변경할 수 없습니다. PowerShell 2.0 명령은 오류를 생성하지 않지만 효과가 없습니다. PowerShell 3.0에 도입된 속성을 변경하려면 PowerShell 3.0에서 WSMan: 드라이브를 사용합니다.