我希望脚本生成一个随机的最后一组 ( Key0
) 并尝试在每次迭代时使用连接字符串 ( Key
)解锁驱动器,但不起作用。我执行脚本,它只是试一试。似乎时间不起作用。
Do {
$Hash0 = 0..5 | % {Get-Random -Minimum 0 -Maximum 9 }
$Key0 = $Hash0 -join ""
$Key = "175615-666567-468105-046717-174922-139634-579799-"+$Key0
manage-bde.exe -unlock H: -recoverypassword $Key >$null
$Status = Get-BitlockerVolume -MountPoint "H:"
} while($Status.CapacityGB -ne "0")
我不是 Powershell 专家。
使用 Do-While 循环,脚本块至少执行一次。
在脚本块运行后评估 While 条件。只要 While 语句中的条件为真,脚本块就会重复执行。
你的声明 While 声明是
while($Status.CapacityGB -ne "0")
您希望在容量GB 不等于 0 时执行 do 循环
如果循环停止,则表明您的 while 语句评估为 false,这表明 CapacityGB 为零。我会检查你在 $status 变量中得到了什么
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句