我使用一段代码从一个机器传输文件到另一台机器上
$PSVersionTable.PSVersion
$uname=”waldevcordew01\discover”
$pwd=ConvertTo-SecureString “666666666” -AsPlainText -Force;
$cred=New-Object System.Management.Automation.PSCredential($uname,$pwd);
$pcname=”waldevcordew01″
$Session = new-PSSession -ComputerName $pcname -Credential $cred
Copy-Item -Path C:\tmp\setup.exe -Destination C:\tmp -ToSession $Session
如果用uname使用域账户的话,就可以传过去。如果不是域账户,就会报错。我应该怎么解决。
new-PSSession : [waldevcordew01] Connecting to remote server
waldevcordew01 failed with the following error message : WinRM cannot process the request. The
following error with errorcode 0x80090311 occurred 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 config. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = new-PSSession -ComputerName $pcname -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
gTransportException
+ FullyQualifiedErrorId : AuthenticationFailed,PSSessionOpenFailed