J'essaie d'exécuter une commande à distance sur un ordinateur doté d'un ". \".Powershell: Impossible de créer un fichier d'informations d'identification avec l'utilisateur point-slash
Lorsque j'essaie les informations d'identification en utilisant get-credentials et en les stockant dans un fichier, je ne suis pas autorisé à le faire. Lorsque je tente de le faire en utilisant
$Username = -join($env:COMPUTERNAME,'\<user_name>')
$Password = '<password>'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass
Invoke-Command -ComputerName <computer_name> -Authentication Kerberos -Credential $Cred {Get-WmiObject -Class Win32_LogicalDisk}
Je reçois l'erreur suivante
Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authenticati
on: 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 config. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
Mais quand je fais un mstsc et d'utiliser les mêmes informations d'identification ça marche.
S'il vous plaît laissez-moi savoir le chemin.
Etes-vous sûr que vous avez besoin de auth avec kerberos? Vous utilisez le computername comme nom de domaine, cela me semble contre-intuitif. – restless1987
Ce code est exécuté dans PS2, j'ai essayé de faire. \ mais le même résultat. J'ai utilisé Kerberos pour l'authentification, plutôt je l'ai trouvé pour être utilisé dans PowerShell 4. –
prasunmax
Le compte que vous utilisez est un compte local, et pas un compte de domaine, non? – restless1987