PowerShell 원격에서 "액세스 거부" 오류가 발생했습니다.
원격 도메인의 서버에서 PowerShell Remote를 사용하여 일부 디스크 크기를 확인하려고 하지만 실행 중인 명령이 작동하지 않습니다.
상황은 이렇습니다.
- 소스 서버가 도메인 A에 있습니다.
- 대상 서버가 도메인 B에 있습니다.
- 이 도메인들 사이에 신뢰가 없습니다.
도메인 B의 서버는 Exchange 2010을 실행하고 있으며, 다음 명령을 사용하여 서버 A에서 Exchange 2010 특정 명령을 실행할 수 있습니다.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri $ConnectionURI -Credential $Credentials -Authentication Basic
Import-PSSession $Session
문제는 이 세션을 사용하여 이 서버에 대해 비 Exchange 명령을 실행할 수 없다는 것입니다. 그러면 명령을 이해할 수 없다고 표시됩니다.Invoke-Command로 Get-Command를 확인하고 실행했는데 설정된 세션에 설정된 -Session 변수는 Exchange 명령만 반환합니다.
그래서 Invoke-Command와 관련된 컴퓨터 이름, 인증 유형 및 자격 증명을 사용하려고 했지만 실패하고 있습니다.
Invoke-Command -ScriptBlock {Get-Service} -ComputerName "Servername.destination.com" -Credential $Credentials -Authentication "Basic"
오류입니다.
[servername.destination.com] Connecting to remote server failed with the following error message : The WinRM client can
not process the request. The authentication mechanism requested by the client is not supported by the server or unencry
pted traffic is disabled in the service configuration. Verify the unencrypted traffic setting in the service configurat
ion or specify one of the authentication mechanisms supported by the server. To use Kerberos, specify the computer nam
e as the remote destination. Also verify that the client computer and the destination computer are joined to a domain.
To use Basic, specify the computer name as the remote destination, specify Basic authentication and provide user name a
nd password. Possible authentication mechanisms reported by server: Negotiate Kerberos For more information, see th
e about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
그래서 Target 서버의 WSMAN 구성으로 들어가 Basic Auth와 암호화되지 않은 연결을 허용하기 위한 관련 설정을 설정합니다.
cd WSMan:\localhost\Service
Set-Item AllowUnencrypted $True
cd .\Auth
Set-Item Basic $True
또한 대상 서버를 원본 도메인 서버의 신뢰할 수 있는 호스트에 추가했습니다.
cd WSMan:\localhost\Client
Set-Item TrustedHosts servername.destination.com
이렇게 하면 오류가 바뀌지만 별로 도움이 되지 않습니다.
PS WSMan:\localhost\Client> Invoke-Command -ScriptBlock {Get-Service} -ComputerName "servername.destination.com" -Creden
tial $Credentials -Authentication "Basic"
[servername.destination.com] Connecting to remote server failed with the following error message : Access is denied. Fo
r more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
도메인 관리자 자격 증명을 -Credential(Get-Credential)을 통해 사용해 보았지만 동일한 문제로 실패하고 있습니다.
사용하려는 사용자는 해당 서버의 로컬 Admins 사용자의 구성원이므로 PSSessionConfiguration 컨테이너에 이미 권한이 설정되어 있어야 합니다.
이것과 함께 더 많은 조언을 받고 싶습니다!WMI만 사용하고 싶은데 현재 방화벽을 통해 활성화되지 않았습니다.
최근에도 비슷한 문제가 있었습니다.연결 중인 사용자가 원격 컴퓨터에 적절한 권한을 가지고 있는지 주의 깊게 확인하는 것이 좋습니다.
다음 명령을 사용하여 권한을 검토할 수 있습니다.
Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Microsoft.PowerShell
여기에서 이 팁을 찾았습니다(링크 업데이트, "unbob" 감사합니다).
https://devblogs.microsoft.com/scripting/configure-remote-security-settings-for-windows-powershell/
고친 거에요.
Running the command prompt or Powershell ISE as an administrator fixed this for me.
Login as Admin in PS ISE and this will resolve the PS remoting issue.
ReferenceURL : https://stackoverflow.com/questions/14127050/powershell-remoting-giving-access-is-denied-error
'programing' 카테고리의 다른 글
프로세서의 워드 크기 확인 (0) | 2023.09.15 |
---|---|
파일에 NS 로그인하는 방법 (0) | 2023.09.15 |
PowerShell 스크립트를 통해 NuGet 설치 (0) | 2023.09.10 |
CSS에서 패딩 속성의 폭이나 높이가 변경되지 않도록 하려면 어떻게 해야 합니까? (0) | 2023.09.10 |
MariaDB 계정이 데이터베이스에 대한 로컬 및 원격 액세스 권한을 가질 수 있습니까? (0) | 2023.09.10 |