我正在编写一个脚本来更改Windows中的bitlocker密码。
我发现" manage-bde -changepassword C:"可以执行以更改然后bitlocker的密码。如果在命令提示符下运行,它将要求用户输入密码并确认密码。它手动很好。 如何通过python子进程模块或vb脚本或使用Powershell来实现这一目标?
我尝试过以下代码,但它无效
import subprocess
p =subprocess.Popen("manage-bde -changepassword C:", shell = True,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p.stdin.write("Passw0rd")
stdout, stderr = p.communicate("Passw0rd")
print stdout
错误:
BitLocker Drive Encryption: Configuration Tool version 10.0.10011
Copyright (C) 2013 Microsoft Corporation. All rights reserved.
ERROR: An error occurred (code 0x80070006):
The handle is invalid.
还尝试下面的vb脚本,但仍然没有运气
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("manage-bde.exe -changepassword C:" ,0,True)
WshShell.SendKeys "P@ssw0rd"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "P@ssw0rd"
WshShell.SendKeys "{ENTER}"