New-ADuser echo用户密码

时间:2016-01-07 14:26:11

标签: forms powershell passwords store

尝试设置一个在我们的AD中创建新用户的powershell表单,脚本运行良好但是这是承包商我需要回显他们输入的密码并将其保存到我导出的csv。以下是我到目前为止的内容

New-ADUser -Name "$d" -AccountExpirationDate "$j" -AccountPassword (Read-Host AsSecureString "Enter a password below")

1 个答案:

答案 0 :(得分:0)

安全字符串并不像人们想象的那样安全。将密码读入变量而不是将$pw = Read-Host -AsSecureString -Prompt "Password" New-ADUser -Name "$d" -AccountExpirationDate "$j" -AccountPassword $pw 放在子表达式中:

$cred = New-Object Management.Automation.PSCredential ('x', $pw)
$cred.GetNetworkCredential().Password

你可以像这样解密安全字符串:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    This method must return a result of type String
相关问题