0

这就是我正在做的事情

$First = Read-Host "Enter First Name"
$Last = Read-Host "Enter Last Name"
$FirstIntitial = $First.Substring(0,1)
$LastInitial = $Last.Substring(0,1)
$FirstLastInitial = $FirstIntitial.ToUpper()+$LastInitial.ToUpper()
$Location = Read-Host "Enter Location"
$Department = Read-Host "Enter Department"
$Database
$Password = $FirstLastInitial+"Company"
Write-Host $Password
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force

当我运行它时,我收到错误:

“无法处理参数“密码”的参数转换。无法将“System.String”类型的“System.Security.SecureString”值转换为“System.Security.SecureString”类型

我对 powershell 很陌生,这是根据我在 google 上找到的内容编写的。我应该如何将密码转换为安全字符串?

4

0 回答 0