这就是我正在做的事情
$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.Security.SecureString”值 “System.String”键入“System.Security.SecureString”
我是PowerShell的新手,这是根据我在谷歌上发现的内容编写的。我该如何将密码转换为securestring?