Powershell 密碼

$keyFile = "D:\aes.key"
$key = New-Object Byte[] 32

$key | out-file $keyFile

Read-Host "Enter Password" -AsSecureString | ConvertFrom-SecureString -key $key | Out-File "D:\pwd.txt"

$userName = "YourUserName"
$passwdFile = "D:\pwd.txt"
$keyFile = "D:\aes.key"
$key = Get-Content $keyFile
$Cred = New-Object -TypeName System.Management.Automation.PSCredential `
-ArgumentList $userName, (Get-Content $passwdFile | ConvertTo-SecureString -Key $key)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章