首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Powershell get-凭据失败

Powershell get-凭据失败
EN

Stack Overflow用户
提问于 2015-01-02 02:31:04
回答 1查看 3.7K关注 0票数 4
代码语言:javascript
运行
复制
PS C:\Windows\system32> $creds = Get-Credential

命令管道位置1处的cmdlet获取凭据为下列参数提供值:

代码语言:javascript
运行
复制
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

我使用的凭据与我用来手动登录的凭据相同。我还有什么地方做错了吗?我尝试过几种不同的方式,但似乎永远无法登录。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-02 04:52:23

尝试以下操作,可以很好地处理域帐户或本地帐户:

代码语言:javascript
运行
复制
# 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 default
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27736735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档