2013-08-17 9 views
12

Alcuni dei nostri server (W2K8 R2) sono stati spostati sul cloud la scorsa settimana, una volta fatto che il mio script powerswhell ha iniziato a fallire (funzionava bene prima), l'eccezione è gettato sulla linea dove la connessione sta cercando di stabilire,WinRM non può elaborare la richiesta - non riesce solo su un dominio specifico

$ExSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri  "http://$g_strExchangeServer/PowerShell" ` 
-Credential $Credentials –Authentication Kerberos 

con il seguente messaggio,

[subd.staging.com] Connecting to remote server failed with the following error message : 
**WinRM cannot process the request**. The following error occured while using Kerberos authentication: There are currently no logon servers available to service the logon request. 
Possible causes are: 
-The user name or password specified are invalid. 
-Kerberos is used when no authentication method and no user name are specified. 
-Kerberos accepts domain user names, but not local user names. 
-The Service Principal Name (SPN) for the remote computer name and port does not exist. 
-The client and remote computers are in different domains and there is no trust between the two domains. 
After checking for the above issues, try the following: 
-Check the Event Viewer for events related to authentication. 
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport. 
Note that computers in the TrustedHosts list might not be authenticated. 
-For more information about WinRM configuration, run the following command: winrm help onfig. For more information, see the about_Remote_Troubleshooting Help topic. 
+ CategoryInfo   : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException 
+ FullyQualifiedErrorId : PSSessionOpenFailed 

questo accade solo se cerco di indirizzare il nostro dominio di prova, se io punto la sceneggiatura il nostro dominio di produzione quindi funziona.

Lo stesso errore viene visualizzato su tutti i server che sono già stati spostati nel cloud.

Si noti che tutti i server che non sono già stati spostati in cloud sono in grado di eseguire lo script su entrambi i domini senza alcun problema.

Ho provato il seguente, ma senza fortuna.

//Add the destination computer to the WinRM TrustedHosts configuration setting. 
c:\>WinRM set winrm/config/client @{TrustedHosts="stagingserver"} 


//Confirm that WinRM is properly configured. 
c:\>Winrm quickconfig 

//Make sure that the remote server allows commands from any machine. 
PS c:\>Set-item wsman:localhost\client\trustedhosts -value * 

Utilizzando PowerShell v2 e WinRM v2

Eventuali commenti sono i benvenuti.

+0

Probabilmente, è questo: "-I client ei computer remoti si trovano in domini diversi e non c'è fiducia tra i due domini." Prova ad usare CredSSP. Ecco come abilitarlo: http://technet.microsoft.com/en-us/library/hh849872.aspx – user1578107

+0

@ user1578107, ho provato ma senza fortuna, c: \> enable-wsmancredssp -role client -delegatecomputer stagingserver. Il comando è stato eseguito correttamente perché non ho ricevuto alcun errore da PS, tuttavia lo script continua a non riuscire con lo stesso messaggio di errore. Grazie. – g3n1t0

+0

non sono sicuro se enable-wsmancredssp consente l'inoltro di nuove credenziali. Puoi provare ad abilitarlo manualmente (vedi http://msdn.microsoft.com/en-us/library/windows/desktop/ee309365(v=vs.85).aspx) – user1578107

risposta

20

eseguire questi comandi sulla macchina client, quindi provare a raggiungere un host remoto:

In primo luogo abbiamo bisogno di controllare TrustedHosts sulla macchina client:

PS C:\> WinRM get winrm/config/client 
Client 
    NetworkDelayms = 5000 
    URLPrefix = wsman 
    AllowUnencrypted = false 
    Auth 
     Basic = true 
     Digest = true 
     Kerberos = true 
     Negotiate = true 
     Certificate = true 
     CredSSP = false 
    DefaultPorts 
     HTTP = 5985 
     HTTPS = 5986 
    TrustedHosts 

Se è vuota come nell'esempio, eseguire il comando in basso a cliente macchina:

PS C:> Set-item wsman: localhost \ client \ TrustedHosts -value *

Questo scriverà * in TrustedHosts parametro che permetterà macchina client di connettersi a qualsiasi host, oppure è possibile configurare questo valore con ip e/o hostname del server di destinazione.

PS C:\> WinRM get winrm/config/client 
Client 
    NetworkDelayms = 5000 
    URLPrefix = wsman 
    AllowUnencrypted = false 
    Auth 
     Basic = true 
     Digest = true 
     Kerberos = true 
     Negotiate = true 
     Certificate = true 
     CredSSP = false 
    DefaultPorts 
     HTTP = 5985 
     HTTPS = 5986 
    TrustedHosts = * 
+0

Questo comando non funziona ... Può per favore fatemi sapere se è necessario riavviare la macchina dopo aver eseguito questo comando – vinay

+0

È necessario utilizzare Powershell per il secondo comando – Eish

+4

Potrebbe essere utile notare che questo comando deve essere eseguito sulla macchina client, cioè quella che effettua la connessione - non sull'host di destinazione. Potrebbe essere necessario riavviare il servizio WinRM in seguito. – w128

Problemi correlati