PowerShell Remoting z błędem „Access is Denied”

Próbuję użyć PowerShell Remoting do sprawdzenia niektórych rozmiarów dysków z serwera w domenie zdalnej, ale działające komendy nie działają.

Sytuacja wygląda następująco:

Serwer źródłowy znajduje się w domenie ASerwer docelowy znajduje się w domenie BPomiędzy tymi domenami nie ma zaufania

Serwer w domenie B działa z Exchange 2010 i mogę uruchomić komendy Exchange 2010 dla niego z serwera A za pomocą tego polecenia:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri $ConnectionURI -Credential $Credentials -Authentication Basic
Import-PSSession $Session

Problem polega na tym, że za pomocą tej sesji nie mogę uruchamiać żadnych poleceń Exchange na tym serwerze, jeśli spróbuję, to mówi, że nie może zrozumieć poleceń. Sprawdziłem i uruchomiłem Get-Command z Invoke-Command, a zmienna -Session ustawiona na moją ustaloną sesję zwraca tylko polecenia Exchange.

Pomyślałem, że spróbuję użyć polecenia Invoke-Command i odpowiedniej nazwy ComputerName, Authentication type i Credentials, ale to się nie powiedzie:

Invoke-Command -ScriptBlock {Get-Service} -ComputerName "Servername.destination.com" -Credential $Credentials -Authentication "Basic"

To jest błąd:

[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

Wchodzę więc do konfiguracji WSMAN na serwerze docelowym i ustawiam odpowiednie ustawienia zezwalające na podstawowe uwierzytelnianie i nieszyfrowane połączenie:

cd WSMan:\localhost\Service
Set-Item AllowUnencrypted $True
cd .\Auth
Set-Item Basic $True

Dodałem także serwer docelowy do zaufanych hostów serwera domeny źródłowej:

cd WSMan:\localhost\Client
Set-Item TrustedHosts servername.destination.com

Po tym błąd się zmienia, ale nie jest to zbyt pomocne:

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

Próbowałem również użyć poświadczeń administratora domeny, poprzez -Credential (Get-Credential), ale to nie działa z tym samym problemem.

Użytkownik, którego próbuję użyć, jest członkiem lokalnych administratorów na danym serwerze, więc uprawnienia powinny być już ustawione w kontenerach PSSessionConfiguration.

Bardzo bym chciał z tym dalej korzystać! Po prostu używałbym WMI, ale w tej chwili nie jest włączony przez zapory.

questionAnswers(2)

yourAnswerToTheQuestion