$pwd = ConvertTo-SecureString “password” -AsPlainText -Force
Add-Device -RackServerUuid uuid -Username USERID -Password $pwd
这样执行没问题
如果是
$pwd = ConvertTo-SecureString “password” -AsPlainText -Force
$cmd_line = “Add-Device -RackServerUuid uuid -Username USERID -Password $pwd”
invoke-expression $cmd_line
返回错误是 Cannot bind parameter ‘Password’. Cannot convert the “System.Security.SecureString” value of type “System.String”
to type “System.Security.SecureString”
请问这样的情况怎样解决呢?谢谢!