Disable-PSRemoting
원격 사용자가 로컬 컴퓨터에서 명령을 실행하지 못하도록 합니다.
구문
Disable-PSRemoting
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Disable-PSRemoting cmdlet을 사용하면 다른 컴퓨터의 사용자가 로컬 컴퓨터에서 명령을 실행할 수 없습니다.
Disable-PSRemoting 로컬 컴퓨터의 모든 세션 구성에 대한 원격 액세스를 차단합니다. 이렇게 하면 원격 사용자가 로컬 컴퓨터에 대한 임시 또는 영구 세션을 만들 수 없습니다. Disable-PSRemoting 로컬 컴퓨터의 사용자가 로컬 컴퓨터 또는 원격 컴퓨터에서 세션(PSSessions)을 만들 수 없습니다.
모든 세션 구성에 대한 원격 액세스를 다시 사용하도록 설정하려면 Enable-PSRemoting cmdlet을 사용합니다. 선택한 세션 구성에 대한 원격 액세스를 사용하도록 설정하려면 Set-PSSessionConfiguration cmdlet의 AccessMode 매개 변수를 사용합니다. Enable-PSSessionConfiguration 및 Disable-PSSessionConfiguration cmdlet을 사용하여 모든 사용자에 대해 세션 구성을 사용하거나 사용하지 않도록 설정할 수도 있습니다. 세션 구성에 대한 자세한 내용은 about_Session_Configurations참조하세요.
Windows PowerShell 2.0에서 Disable-PSRemoting 모든 사용자가 로컬 컴퓨터에 대한 사용자 관리 세션을 만들지 못하게 합니다. Windows PowerShell 3.0에서 Disable-PSRemoting 사용하면 다른 컴퓨터의 사용자가 로컬 컴퓨터에서 사용자 관리 세션을 만들지 못하지만 로컬 컴퓨터의 사용자가 사용자 관리 루프백 세션을 만들 수 있습니다.
이 cmdlet을 실행하려면 관리자 권한으로 실행 옵션을 사용하여 Windows PowerShell을 시작합니다.
주의: Windows PowerShell 3.0 및 Windows PowerShell 2.0 엔진이 모두 있는 시스템에서는 Windows PowerShell 2.0을 사용하여
예제
예제 1: 모든 세션 구성에 대한 원격 액세스 방지
PS C:\> Disable-PSRemoting
이 명령은 컴퓨터의 모든 세션 구성에 대한 원격 액세스를 차단합니다.
예제 2: 확인 프롬프트 없이 모든 세션 구성에 대한 원격 액세스 방지
PS C:\> Disable-PSRemoting -Force
이 명령은 프롬프트 없이 컴퓨터의 모든 세션 구성에 원격으로 액세스할 수 없도록 합니다.
예제 3: 이 cmdlet 실행의 효과
PS C:\> Disable-PSRemoting -Force
[ADMIN] PS C:\> New-PSSession -ComputerName localhost
Id Name ComputerName State Configuration Availability
-- ---- ------------ ----- ------------- ------------
1 Session1 Server02... Opened Microsoft.PowerShell Available
# On Server02 remote computer:
PS C:\> New-PSSession -ComputerName Server01
[SERVER01] Connecting to remote server failed with the following error
message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
이 예제에서는 Disable-PSRemoting cmdlet을 사용하는 효과를 보여 줍니다. 이 명령 순서를 실행하려면 관리자 권한으로 실행 옵션을 사용하여 Windows PowerShell을 시작합니다.
첫 번째 명령은 Disable-PSRemoting cmdlet을 사용하여 Server01 컴퓨터에서 등록된 모든 세션 구성을 사용하지 않도록 설정합니다.
두 번째 명령은 New-PSSession cmdlet을 사용하여 로컬 컴퓨터("루프백"라고도 함)에 대한 원격 세션을 만듭니다. 명령이 성공합니다.
세 번째 명령은 Server02 원격 컴퓨터에서 실행됩니다. 이 명령은 New-PSSession cmdlet을 사용하여 Server01 원격 컴퓨터에 대한 세션을 만듭니다. 원격 액세스를 사용할 수 없으므로 명령이 실패합니다.
예제 4: 이 cmdlet 및 Enable-PSRemoting 실행의 효과
PS C:\> Disable-PSRemoting -force
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
[ADMIN] PS C:\> Enable-PSRemoting -Force
WinRM already is set up to receive requests on this machine.
WinRM already is set up for remote management on this machine.
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto
Name Permission
---- ----------
microsoft.powershell BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow BUILTIN\Administrators AccessAllowed
microsoft.powershell32 BUILTIN\Administrators AccessAllowed
microsoft.ServerManager BUILTIN\Administrators AccessAllowed
WithProfile BUILTIN\Administrators AccessAllowed
이 예제에서는
첫 번째 명령은 Disable-PSRemoting cmdlet을 사용하여 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정합니다. Force 매개 변수는 모든 사용자 프롬프트를 표시하지 않습니다.
두 번째 명령은 Get-PSSessionConfiguration cmdlet을 사용하여 컴퓨터에 세션 구성을 표시합니다. 이 명령은 파이프라인 연산자를 사용하여 결과를 테이블에 있는 구성의 이름 및 사용 권한 속성만 표시하는 Format-Table 명령으로 보냅니다.
출력은 원격 사용자만 구성에 대한 액세스가 거부됨을 보여 줍니다. 로컬 컴퓨터의 Administrators 그룹 구성원은 세션 구성을 사용할 수 있습니다. 또한 출력은 명령이 사용자가 만든 WithProfile 세션 구성을 포함하는 모든 세션 구성에 영향을 줍니다.
세 번째 명령은 Enable-PSRemoting cmdlet을 사용하여 컴퓨터의 모든 세션 구성에 대한 원격 액세스를 다시 사용하도록 설정합니다. 이 명령은 Force 매개 변수를 사용하여 모든 사용자 프롬프트를 표시하지 않고 WinRM 서비스를 다시 시작합니다.
네 번째 명령은 Get-PSSessionConfiguration 및 Format-Table cmdlet을 사용하여 세션 구성의 이름과 권한을 표시합니다. 결과는 AccessDenied 보안 설명자가 모든 세션 구성에서 제거되었음을 보여 줍니다.
예제 5: 사용자 지정 보안 설명자가 있는 세션 구성에 대한 원격 액세스 방지
PS C:\> Register-PSSessionConfiguration -Name Test -FilePath .\TestEndpoint.pssc -ShowSecurityDescriptorUI
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
Name Permission
---- ----------
microsoft.powershell BUILTIN\Administrators AccessAllowed
Test NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed,
DOMAIN01\User01 AccessAllowed
[ADMIN] PS C:\> Disable-PSRemoting -Force
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
Test NT AUTHORITY\NETWORK AccessDenied, NTAUTHORITY\INTERACTIVE AccessAllowed,
BUILTIN\Administrators AccessAllowed, DOMAIN01\User01 AccessAllowed
# Domain01\User01
PS C:\> New-PSSession -ComputerName Server01 -ConfigurationName Test
[Server01] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Rem
ote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
이 예제에서는 Disable-PSRemoting cmdlet이 사용자 지정 보안 설명자가 있는 세션 구성을 포함하는 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정하는 방법을 보여 줍니다.
첫 번째 명령은 Register-PSSessionConfiguration cmdlet을 사용하여 테스트 세션 구성을 만듭니다. 이 명령은 FilePath 매개 변수를 사용하여 세션을 사용자 지정하는 세션 구성 파일과 ShowSecurityDescriptorUI 매개 변수를 지정하여 세션 구성에 대한 권한을 설정하는 대화 상자를 표시합니다. 사용 권한 대화 상자에서 Domain01\User01 사용자에 대한 사용자 지정 전체 액세스 권한을 만듭니다.
두 번째 명령은 Get-PSSessionConfiguration 및 Format-Table cmdlet을 사용하여 세션 구성 및 해당 속성을 표시합니다. 출력은 테스트 세션 구성에서 Domain01\User01 사용자에 대한 대화형 액세스 및 특수 권한을 허용한다는 것을 보여 줍니다.
세 번째 명령은 Disable-PSRemoting cmdlet을 사용하여 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정합니다.
네 번째 명령은 Get-PSSessionConfiguration 및 Format-Table cmdlet을 사용하여 세션 구성 및 해당 속성을 표시합니다. 출력은 모든 네트워크 사용자에 대한 AccessDenied 보안 설명자가 테스트 세션 구성을 포함하는 모든 세션 구성에 추가됨을 보여 줍니다. 다른 보안 설명자는 변경되지 않지만 "network_deny_all" 보안 설명자가 우선합니다.
다섯 번째 명령은 Disable-PSRemoting 명령을 사용하면 테스트 세션 구성에 대한 특별한 권한이 있는 Domain01\User01 사용자도 테스트 세션 구성을 사용하여 컴퓨터에 원격으로 연결할 수 없도록 합니다.
예제 6: 선택한 세션 구성에 대한 원격 액세스 다시 사용
PS C:\> Disable-PSRemoting -Force
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
[ADMIN] PS C:\> Set-PSSessionConfiguration -Name Microsoft.ServerManager -AccessMode Remote -Force
[ADMIN] PS C:\> Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
이 예제에서는 선택한 세션 구성에 대해서만 원격 액세스를 다시 사용하도록 설정하는 방법을 보여 줍니다.
첫 번째 명령은 Disable-PSRemoting cmdlet을 사용하여 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정합니다.
두 번째 명령은 Get-PSSessionConfiguration 및 Format-Table cmdlet을 사용하여 세션 구성 및 해당 속성을 표시합니다. 출력은 모든 네트워크 사용자에 대한 AccessDenied 보안 설명자가 모든 세션 구성에 추가되었음을 보여 줍니다.
세 번째 명령은 Set-PSSessionConfiguration cmdlet을 사용합니다. 이 명령은 AccessMode 매개 변수와 원격 값을 사용하여 Microsoft.ServerManager 세션 구성에 대한 원격 액세스를 사용하도록 설정합니다. AccessMode 매개 변수를 사용하여 로컬 액세스를 사용하도록 설정하고 세션 구성을 사용하지 않도록 설정할 수도 있습니다.
네 번째 명령은 Get-PSSessionConfiguration 및 Format-Table cmdlet을 사용하여 세션 구성 및 해당 속성을 표시합니다. 출력은 모든 네트워크 사용자에 대한 AccessDenied 보안 설명자가 제거되어 Microsoft.ServerManager 세션 구성에 대한 원격 액세스를 복원하는 것을 보여줍니다.
매개 변수
-Confirm
cmdlet을 실행하기 전에 확인 메시지를 표시합니다.
형식: | SwitchParameter |
별칭: | cf |
Position: | Named |
Default value: | False |
필수: | False |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
-Force
사용자 확인을 요청하지 않고 명령을 강제로 실행합니다.
형식: | SwitchParameter |
Position: | Named |
Default value: | None |
필수: | False |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
-WhatIf
cmdlet이 실행되면 어떻게 되는지 보여 주세요. cmdlet이 실행되지 않습니다.
형식: | SwitchParameter |
별칭: | wi |
Position: | Named |
Default value: | False |
필수: | False |
파이프라인 입력 허용: | False |
와일드카드 문자 허용: | False |
입력
None
이 cmdlet에 입력을 파이프할 수 없습니다.
출력
None
이 cmdlet은 개체를 반환하지 않습니다.
참고
세션 구성을 사용하지 않도록 설정해도
Enable-PSRemoting 또는 enable-PSSessionConfiguration cmdlet을변경한 내용이 모두 실행 취소되지는 않습니다. 다음 변경 내용을 수동으로 실행 취소해야 할 수 있습니다.
WinRM 서비스를 중지하고 사용하지 않도록 설정합니다.
2. IP 주소에 대한 요청을 수락하는 수신기를 삭제합니다.
3. WS-Management 통신에 대한 방화벽 예외를 사용하지 않도록 설정합니다.
4. LocalAccountTokenFilterPolicy 값을 0으로 복원하여 컴퓨터의 Administrators 그룹 구성원에 대한 원격 액세스를 제한합니다.
세션 구성은 세션에 대한 환경을 정의하는 설정 그룹입니다. 컴퓨터에 연결하는 모든 세션은 컴퓨터에 등록된 세션 구성 중 하나를 사용해야 합니다. 모든 세션 구성에 대한 원격 액세스를 거부하면 원격 사용자가 컴퓨터에 연결하는 세션을 설정하지 못하도록 효과적으로 방지할 수 있습니다.
Windows PowerShell 2.0에서 Disable-PSRemoting 모든 세션 구성의 보안 설명자에 Deny_All 항목을 추가합니다. 이 설정을 사용하면 모든 사용자가 로컬 컴퓨터에 대한 사용자 관리 세션을 만들 수 없습니다. Windows PowerShell 3.0에서 Disable-PSRemoting 모든 세션 구성의 보안 설명자에 Network_Deny_All 항목을 추가합니다. 이 설정을 사용하면 다른 컴퓨터의 사용자가 로컬 컴퓨터에서 사용자 관리 세션을 만들 수 없지만 로컬 컴퓨터의 사용자가 사용자 관리 루프백 세션을 만들 수 있습니다.
Windows PowerShell 2.0에서 Disable-PSRemotingDisable-PSSessionConfiguration -Name *
동일합니다.
Windows PowerShell 3.0 이상 릴리스에서 Disable-PSRemotingSet-PSSessionConfiguration -Name \<Configuration name\> -AccessMode Local
Windows PowerShell 2.0에서 Disable-PSRemoting 함수입니다. Windows PowerShell 3.0부터 cmdlet입니다.