PSCredential的创建没有密码密码、PSCredential

由网友(浅醉丶且听风吟)分享简介:如何创建PSCredential的没有密码一个实例?我试过东西:$ mycreds =新对象System.Management.Automation.PSCredential(用户名,$空)错误:无法处理参数,因为参数密码的值为null $ mycreds =新对象System.Management.Automat...

如何创建PSCredential的没有密码一个实例?

我试过

东西:

$ mycreds =新对象System.Management.Automation.PSCredential(用户名,$空) 错误:无法处理参数,因为参数密码的值为null

$ mycreds =新对象System.Management.Automation.PSCredential(用户名,(的ConvertTo-S​​ecureString的$空-AsPlainText -Force)) 错误:的ConvertTo-S​​ecureString的:无法绑定参数参数'串',因为它是空

$ mycreds =新对象System.Management.Automation.PSCredential(用户名,(的ConvertTo-S​​ecureString的-AsPlainText -Force)) 错误:的ConvertTo-S​​ecureString的:无法绑定参数,参数字符串,因为它是一个空字符串

解决方案

解决方法:

  $ mycreds =新对象System.Management.Automation.PSCredential(用户名,(新对象为System.Security.SecureString))
 

对不起,愚蠢的问题。我使用PowerShell的首次不研究。速成班!

How to create a instance in PSCredential that has no password?

急需ps软件的账号和密码,谢谢

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!

阅读全文

相关推荐

最新文章