J'essaie de tester si winrm fonctionne sur une liste de systèmes; Cependant, je n'arrive pas à saisir/réduire l'erreur qui apparaît lorsque j'essaie de me connecter à un système. Il semble fonctionner sur un système:Test de la connectivité WinRM/WSMan?
PS C:\Users\Egr> winrm id -r:system1
IdentifyResponse
ProtocolVersion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor = Microsoft Corporation
ProductVersion = OS: x.x.xxxx SP: x.x Stack: x.x
Mais ne fonctionne pas sur un autre:
PS C:\Users\Egr> winrm id -r:system2
WSManFault
Message = WinRM cannot process the request. The following error occured while using Kerberos authentication: The net
work path was not found.
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 config.
Error number: -2147024843 0x80070035
The network path was not found.
J'ai essayé qui l'entoure dans un bloc try/catch, mais il ne semble pas le silence. J'essaye d'exécuter une vérification contre ces systèmes pour déterminer ceux qui ont WinRM configurés correctement et qui fonctionnent; mais si le script continue à sortir ce texte, il ne fonctionnera pas très bien. Est-il possible de supprimer ce texte, ou existe-t-il un meilleur moyen de tester la connectivité WinRM?
Je ne savais pas rediriger le flux d'erreur, merci! – EGr
Existe-t-il un moyen de diriger cette sortie vers une autre variable? J'ai essayé de faire quelque chose comme 'winrm id -r: $ rhost 2> $ tempvar', mais $ tempvar ne change pas – EGr
Ce n'est pas comme ça que fonctionnent les opérateurs de redirection. '2> $ tempvar' redirigerait le flux d'erreurs vers le nom de fichier dans' $ tempvar'. Pour capturer le flux d'erreurs dans une variable, essayez ce que @manojlds a suggéré [ici] (http://serverfault.com/a/340716). –