PSCredential的创建没有密码 [英] Create PSCredential without a password
问题描述
如何创建PSCredential的没有密码一个实例?
我试过东西:
-
$ mycreds =新对象System.Management.Automation.PSCredential(用户名,$空)
错误:无法处理参数,因为参数密码的值为null -
$ mycreds =新对象System.Management.Automation.PSCredential(用户名,(的ConvertTo-SecureString的$空-AsPlainText -Force))
错误:的ConvertTo-SecureString的:无法绑定参数参数'串',因为它是空 -
$ mycreds =新对象System.Management.Automation.PSCredential(用户名,(的ConvertTo-SecureString的-AsPlainText -Force))
错误:的ConvertTo-SecureString的:无法绑定参数,参数字符串,因为它是一个空字符串
解决方法:
$ mycreds =新对象System.Management.Automation.PSCredential(用户名,(新对象为System.Security.SecureString))
对不起,愚蠢的问题。我使用PowerShell的首次不研究。速成班!
How to create a instance in PSCredential that has no password?
Things I tried:
$mycreds = New-Object System.Management.Automation.PSCredential ("username", $null)
Error: Cannot process argument because the value of argument "password" is null$mycreds = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString $null -AsPlainText -Force))
Error: ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is null.$mycreds = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "" -AsPlainText -Force))
Error: ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is an empty string.
Solution:
$mycreds = New-Object System.Management.Automation.PSCredential ("username", (new-object System.Security.SecureString))
Sorry for the dumb question. I'm using Powershell for the first time without studying. A crash course!
这篇关于PSCredential的创建没有密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!