PS C:\Windows\system32> $creds = Get-Credential命令管道位置1处的cmdlet获取凭据为下列参数提供值:
PS C:\Windows\system32> $ses = New-PSSession -ComputerName WIN-O4VC136J0E2 -Credential $creds新建-PSSession: WIN-O4VC136J0E2连接到远程服务器WIN-O4VC136J0E2失败,出现以下错误消息:用户名或密码不正确。有关更多信息,请参见about_Remote_Troubleshooting帮助主题。一行:1字符:8+ $ses =新-PSSession -ComputerName WIN-O4VC136J0E2 -Credential $creds +~+ CategoryInfo : OpenError: PSRemotin New-PSSession,PSRemotin gTransportException + FullyQualifiedErrorId : LogonFailure,PSSessionOpenFailed
我使用的凭据与我用来手动登录的凭据相同。我还有什么地方做错了吗?我尝试过几种不同的方式,但似乎永远无法登录。
发布于 2015-01-02 04:52:23
尝试以下操作,可以很好地处理域帐户或本地帐户:
# Enter your pass and stores it securely:
$SecureString = Read-Host -AsSecureString 'Enter your password ' | ConvertFrom-SecureString | ConvertTo-SecureString
# Users you password securly
$MySecureCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "MyLoCalMachine\MyUserID",$SecureString
# Sets yous credentials to be used
$RemoteConn = New-PSSession -ComputerName $ts -Credential $MySecureCreds -Authentication defaulthttps://stackoverflow.com/questions/27736735
复制相似问题