0
点赞
收藏
分享

微信扫一扫

PowerShell 保存凭据并转换成字符

将字符保存成凭据

$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

举报

相关推荐

0 条评论