【发布时间】:2011-07-27 03:19:28
【问题描述】:
如何创建一个没有密码的 PSCredential 实例? (无需手动填写Get-Credential无密码对话框,这是无人值守运行。)
我尝试过的事情:
$mycreds = New-Object System.Management.Automation.PSCredential ("username", $null)错误:无法处理参数,因为参数“密码”的值为空$mycreds = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString $null -AsPlainText -Force))错误:ConvertTo-SecureString:无法将参数绑定到参数“String”,因为它为空。$mycreds = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "" -AsPlainText -Force))错误:ConvertTo-SecureString:无法将参数绑定到参数“String”,因为它是一个空字符串。
【问题讨论】:
-
pscredential 需要密码。
标签: .net powershell powershell-2.0 system.management