将字符保存成凭据
$userName = "admin"
$password = ConvertTo-SecureString "123" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential -ArgumentList ($userName, $password)
将凭据转换成字符
$bStr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($psCred.Password)
System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bStr)
123
Loading
Done
标签:转换成,字符,凭据,System,InteropServices,psCred,Runtime,PowerShell From: https://blog.51cto.com/xingjia/6113344