Disable-PSRemoting

PowerShell 엔드포인트가 원격 연결을 수신하지 못하도록 합니다.

Syntax

Disable-PSRemoting
       [-Force]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

cmdlet은 Disable-PSRemoting 로컬 컴퓨터의 모든 Windows PowerShell 세션 엔드포인트 구성에 대한 원격 액세스를 차단합니다. 여기에는 PowerShell 6 이상에서 만든 모든 엔드포인트가 포함됩니다.

모든 세션 구성에 대한 원격 액세스를 다시 사용하도록 설정하려면 cmdlet을 Enable-PSRemoting 사용합니다. 여기에는 PowerShell 6 이상에서 만든 모든 엔드포인트가 포함됩니다. 선택한 세션 구성에 대한 원격 액세스를 사용하도록 설정하려면 cmdlet의 AccessMode 매개 변수를 Set-PSSessionConfiguration 사용합니다. 및 Disable-PSSessionConfiguration cmdlet을 사용하여 모든 사용자에 Enable-PSSessionConfiguration 대해 세션 구성을 사용하거나 사용하지 않도록 설정할 수도 있습니다. 세션 구성에 대한 자세한 내용은 about_Session_Configurations를 참조하세요.

참고 항목

실행 Disable-PSRemoting 후에도 로컬 컴퓨터에서 루프백 연결을 만들 수 있습니다. 루프백 연결은 동일한 로컬 컴퓨터에서 시작되어 연결하는 PowerShell 원격 세션입니다. 외부 원본의 원격 세션이 다시 차단되지 기본. 루프백 연결의 경우 EnableNetworkAccess 매개 변수를 따라 암시적 자격 증명을 사용해야 합니다. 루프백 연결에 대한 자세한 내용은 New-PSSession을 참조 하세요.

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

예제

예제 1: 모든 세션 구성에 대한 원격 액세스 방지

이 예제에서는 컴퓨터의 모든 PowerShell 세션 엔드포인트 구성에 대한 원격 액세스를 방지합니다.

Disable-PSRemoting

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these
 steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

예제 2: 확인 프롬프트 없이 모든 세션 구성에 대한 원격 액세스 방지

이 예제에서는 프롬프트 없이 컴퓨터의 모든 PowerShell 세션 엔드포인트 구성에 원격 액세스를 방지합니다.

Disable-PSRemoting -Force

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these
 steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

예제 3: 이 cmdlet 실행의 효과

이 예제에서는 cmdlet을 사용하는 Disable-PSRemoting 효과를 보여 주세요. 이 명령 순서를 실행하려면 관리자 권한으로 실행 옵션을 사용하여 PowerShell을 시작합니다.

세션 구성을 사용하지 않도록 설정하면 cmdlet은 New-PSSession 로컬 컴퓨터("루프백"라고도 함)에 대한 원격 세션을 만들려고 시도합니다. 로컬 컴퓨터에서 원격 액세스를 사용할 수 없으므로 명령이 실패합니다.

Disable-PSRemoting -Force
New-PSSession -ComputerName localhost

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

New-PSSession : [localhost] Connecting to remote server localhost failed with the following error
 message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName localhost -ConfigurationName PowerShell.6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (System.Management.A\u2026tion.RemoteRunspace:RemoteRunspace)
 [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed

예제 4: 이 cmdlet 및 Enable-PSRemoting 실행 효과

이 예제에서는 및 Enable-PSRemoting cmdlet을 사용하는 세션 구성에 Disable-PSRemoting 미치는 영향을 보여 줍니다.

Disable-PSRemoting 는 모든 PowerShell 세션 엔드포인트 구성에 대한 원격 액세스를 사용하지 않도록 설정하는 데 사용됩니다. Force 매개 변수는 모든 사용자 프롬프트를 표시하지 않습니다. 및 Format-Table cmdlet은 Get-PSSessionConfiguration 컴퓨터의 세션 구성을 표시합니다.

출력은 네트워크 토큰이 있는 모든 원격 사용자가 엔드포인트 구성에 대한 액세스가 거부되었음을 보여 줍니다. 로컬 컴퓨터의 관리istrators 그룹은 로컬로 연결(루프백이라고도 함)하고 암시적 자격 증명을 사용하는 한 엔드포인트 구성에 액세스할 수 있습니다.

Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize

Enable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize

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

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

cmdlet을 Enable-PSRemoting 사용하면 컴퓨터의 모든 PowerShell 세션 엔드포인트 구성에 원격으로 다시 액세스할 수 있습니다. Force 매개 변수는 모든 사용자 프롬프트를 표시하지 않고 메시지를 표시하지 않고 WinRM 서비스를 다시 시작합니다. 새 출력은 AccessDenied 보안 설명자가 모든 세션 구성에서 제거되었음을 보여 줍니다.

예제 5: 세션 엔드포인트 구성이 비활성화된 루프백 연결

이 예제에서는 엔드포인트 구성을 사용하지 않도록 설정한 방법을 보여 줍니다. 사용 안 함 엔드포인트에 대한 루프백 연결을 성공적으로 만드는 방법을 보여 줍니다. Disable-PSRemoting 는 모든 PowerShell 세션 엔드포인트 구성을 사용하지 않도록 설정합니다.

Disable-PSRemoting -Force
New-PSSession -ComputerName localhost

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

New-PSSession : [localhost] Connecting to remote server localhost failed with the following error message : Access is
denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed

New-PSSession -ComputerName localhost -EnableNetworkAccess

Id Name       Transport ComputerName  ComputerType   State   ConfigurationName   Availability
 -- ----       --------- ------------  ------------   -----   -----------------   ------------
 1  Runspace1  WSMan     localhost     RemoteMachine  Opened  powershell.6           Available

로컬 컴퓨터에 대한 원격 세션을 만들려는 시도의 New-PSSession 첫 번째 사용입니다. 이 유형의 연결은 네트워크 스택을 통과하며 루프백이 아닙니다. 따라서 Access가 거부된 상태에서 비활성화된 엔드포인트에 대한 연결 시도가 실패합니다.

또한 두 번째 사용 New-PSSession 은 로컬 컴퓨터에 대한 원격 세션을 만들려고 시도합니다. 이 경우 네트워크 스택을 우회하는 루프백 연결이므로 성공합니다.

루프백 연결은 다음 조건이 충족될 때 생성됩니다.

  • 연결할 컴퓨터 이름은 'localhost'입니다.
  • 자격 증명이 전달되지 않습니다. 현재 로그인한 사용자(암시적 자격 증명)가 연결에 사용됩니다.
  • EnableNetworkAccess 스위치 매개 변수가 사용됩니다.

루프백 연결에 대한 자세한 내용은 New-PSSession 문서를 참조하세요.

예제 6: 사용자 지정 보안 설명자가 있는 세션 구성에 대한 원격 액세스 방지

이 예제에서는 cmdlet이 Disable-PSRemoting 사용자 지정 보안 설명자가 있는 세션 구성을 포함하는 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정하는 방법을 보여 줍니다.

Register-PSSessionConfiguration는 테스트 세션 구성을 만듭니다. FilePath 매개 변수는 세션을 사용자 지정하는 세션 구성 파일을 지정합니다. ShowSecurityDescriptorUI 매개 변수는 세션 구성에 대한 권한을 설정하는 대화 상자를 표시합니다. 사용 권한 대화 상자에서 표시된 사용자에 대한 사용자 지정 전체 액세스 권한을 만듭니다.

Format-Table cmdlet은 Get-PSSessionConfiguration 세션 구성 및 해당 속성을 표시합니다. 출력은 테스트 세션 구성에서 표시된 사용자에 대한 대화형 액세스 및 특수 권한을 허용함을 보여 줍니다.

Disable-PSRemoting 는 모든 세션 구성에 대한 원격 액세스를 사용하지 않도록 설정합니다.

Register-PSSessionConfiguration -Name Test -FilePath .\TestEndpoint.pssc -ShowSecurityDescriptorUI -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap

Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
New-PSSession -ComputerName localhost -ConfigurationName Test

Name                          Permission
----                          ----------
microsoft.powershell          BUILTIN\Administrators AccessAllowed
Test                          NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed,
DOMAIN01\User01 AccessAllowed

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

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


[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

Get-PSSessionConfiguration 이제 및 Format-Table cmdlet은 테스트 세션 구성을 포함하여 모든 네트워크 사용자에 대한 AccessDenied 보안 설명자가 모든 세션 구성에 추가되었음을 보여 줍니다. 다른 보안 설명자는 변경되지 않지만 "network_deny_all" 보안 설명자가 우선합니다. 이는 테스트 세션 구성에 연결하는 데 사용 New-PSSession 하려는 시도에 의해 설명됩니다.

예제 7: 선택한 세션 구성에 대한 원격 액세스 다시 사용

이 예제에서는 선택한 세션 구성에 대해서만 원격 액세스를 다시 사용하도록 설정하는 방법을 보여 줍니다. 모든 세션 구성을 사용하지 않도록 설정한 후 특정 세션을 다시 사용하도록 설정합니다.

cmdlet Set-PSSessionConfiguration 은 Microsoft를 변경하는 데 사용됩니다. ServerManager 세션 구성. 원격이 있는 AccessMode 매개 변수는 구성에 대한 원격 액세스를 다시 사용하도록 설정합니다.

Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize

Set-PSSessionConfiguration -Name Microsoft.ServerManager -AccessMode Remote -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize

WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
 or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
    1. Stop and disable the WinRM service.
    2. Delete the listener that accepts requests on any IP address.
    3. Disable the firewall exceptions for WS-Management communications.
    4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
       members of the Administrators group on the computer.

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

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

매개 변수

-Confirm

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

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

-Force

사용자 확인을 요청하지 않고 명령을 강제 실행합니다.

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

입력

None

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

출력

None

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

참고

  • 세션 구성을 사용하지 않도록 설정해도 해당 또는 Enable-PSSessionConfiguration cmdlet에서 수행한 모든 변경 내용이 Enable-PSRemoting 실행 취소되지는 않습니다. 다음 변경 내용을 수동으로 실행 취소해야 할 수 있습니다.

    1. 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-PSRemoting 에서는 다음과 같습니다 Disable-PSSessionConfiguration -Name *. Windows PowerShell 3.0 이상 릴리스 Disable-PSRemoting 에서는 다음과 같습니다. Set-PSSessionConfiguration -Name \<Configuration name\> -AccessMode Local