Unregister-PSSessionConfiguration

컴퓨터에서 등록된 세션 구성을 삭제합니다.

Syntax

Unregister-PSSessionConfiguration
          [-Name] <String>
          [-Force]
          [-NoServiceRestart]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]

Description

이 cmdlet은 Windows 플랫폼에서만 사용할 수 있습니다.

cmdlet은 Unregister-PSSessionConfiguration 컴퓨터에서 등록된 세션 구성을 삭제합니다. 이 cmdlet은 시스템 관리자가 사용자에 대한 사용자 지정 세션 구성을 관리하도록 설계되었습니다.

변경을 적용 Unregister-PSSessionConfiguration 하려면 WinRM 서비스를 다시 시작합니다. 다시 시작하지 않도록 하려면 NoServiceRestart 매개 변수를 지정합니다.

기본 Microsoft.PowerShell 또는 Microsoft.PowerShell32 세션 구성을 실수로 삭제하는 경우 cmdlet을 Enable-PSRemoting 사용하여 복원합니다. 자세한 내용은 about_Session_Configurations 참조하세요.

예제

예제 1: 세션 구성 삭제

다음은 컴퓨터에서 세션 구성을 MaintenanceShell 삭제하는 예제입니다.

Unregister-PSSessionConfiguration -Name "MaintenanceShell"

예제 2: 세션 구성 삭제 및 WinRM 서비스 다시 시작

이 예제에서는 구성을 MaintenanceShell 삭제하고 WinRM 서비스를 다시 시작합니다. Force 매개 변수는 메시지를 표시하지 않고 WinRM 서비스를 다시 시작하도록 모든 사용자 메시지를 표시하지 않습니다.

Unregister-PSSessionConfiguration -Name MaintenanceShell -Force

예제 3: 모든 세션 구성 삭제

이 예제에서는 컴퓨터의 모든 세션 구성을 삭제하는 두 가지 방법을 보여 줍니다. 두 명령 모두 동일한 효과를 가지며 서로 바꿔 사용할 수 있습니다.

Unregister-PSSessionConfiguration -Name *
Get-PSSessionConfiguration -Name * | Unregister-PSSessionConfiguration

예제 4: 다시 시작하지 않고 등록 취소

이 예제에서는 NoServiceRestart 매개 변수를 사용하여 컴퓨터의 모든 세션을 방해하는 서비스를 다시 시작하지 못하게 하는 효과를 보여 줍니다.

PS> Unregister-PSSessionConfiguration -Name "MaintenanceShell" -NoServiceRestart
PS> Get-PSSessionConfiguration -Name "MaintenanceShell"

Get-PSSessionConfiguration -Name MaintenanceShell : No Session Configuration matches criteria "MaintenanceShell".
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException

PS> New-PSSession -ConfigurationName "MaintenanceShell"

Id Name      ComputerName    State    Configuration         Availability
-- ----      ------------    -----    -------------         ------------
1 Session1  localhost       Opened   MaintenanceShell      Available

PS> Restart-Service winrm
PS> New-PSSession -ConfigurationName MaintenanceShell

[localhost] Connecting to remote server failed with the following error message :
 The WS-Management service cannot process the request.
 The resource URI (http://schemas.microsoft.com/powershell/MaintenanceShell) was not found in the WS-Management catalog.
 The catalog contains the metadata that describes resources, or logical endpoints.
 For more information, see the about_Remote_Troubleshooting Help topic.
 + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
 + FullyQualifiedErrorId : PSSessionOpenFailed

Unregister-PSSessionConfiguration 세션 구성을 MaintenanceShell 삭제합니다. 그러나 명령이 NoServiceRestart 매개 변수를 사용하므로 WinRM 서비스가 다시 시작되지 않고 변경 내용이 아직 완전히 적용되지 않습니다.

다음으로 세션을 Get-PSSessionConfiguration 가져오려고 시도합니다 MaintenanceShell . WS-Management 리소스 테이블에서 Get-PSSessionConfiguration 세션이 제거되었으므로 세션을 반환할 수 없습니다.

cmdlet은 New-PSSession 구성을 사용하여 MaintenanceShell 세션을 만듭니다. 명령이 성공합니다. 다음으로 WinRM 서비스를 다시 시작합니다.

마지막으로 cmdlet은 New-PSSession 구성을 사용하는 MaintenanceShell 세션을 만들려고 합니다. 이번에는 WinRM 서비스가 다시 시작될 때 구성이 MaintenanceShell 삭제되었기 때문에 세션이 실패합니다.

매개 변수

-Confirm

cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.

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

-Force

cmdlet에서 확인 메시지를 표시하지 않고 메시지를 표시하지 않고 WinRM 서비스를 다시 시작합니다. 서비스를 다시 시작하면 구성 변경 내용이 적용됩니다.

다시 시작을 방지하고 다시 시작 프롬프트를 표시하지 않도록 하려면 NoServiceRestart 매개 변수를 사용합니다.

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

-Name

삭제할 세션 구성의 이름을 지정합니다. 하나의 세션 구성 이름 또는 구성 이름 패턴을 입력합니다. 와일드카드 문자를 사용할 수 있습니다. 이 매개 변수는 필수입니다.

세션 구성을 .에 파이프할 Unregister-PSSessionConfiguration수도 있습니다.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

-NoServiceRestart

이 cmdlet이 WinRM 서비스를 다시 시작하지 않고 서비스를 다시 시작하라는 프롬프트를 표시하지 않음을 나타냅니다.

기본적으로 명령을 실행 Unregister-PSSessionConfiguration 하면 변경 내용이 적용되도록 WinRM 서비스를 다시 시작하라는 메시지가 표시됩니다. WinRM 서비스를 다시 시작할 때까지 사용자는 아직 등록되지 않은 세션 구성 Get-PSSessionConfiguration 을 사용할 수 있습니다.

메시지를 표시하지 않고 WinRM 서비스를 다시 시작하려면 Force 매개 변수를 지정합니다. WinRM 서비스를 수동으로 다시 시작하려면 cmdlet을 Restart-Service 사용합니다.

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

-WhatIf

cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.

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

입력

Microsoft.PowerShell.Commands.PSSessionConfigurationCommands

세션 구성 개체를 이 cmdlet으로 파이프할 수 있습니다.

출력

None

이 cmdlet은 출력을 반환하지 않습니다.

참고

이 cmdlet은 Windows 플랫폼에서만 사용할 수 있습니다.

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