I am writing a script to change the bitlocker password in windows.
I have found that "manage-bde -changepassword C:" can be executed to change the password for then bitlocker. If run in command prompt it will ask the user to enter the password and confirm the password. It worked well manually. How can I achieve this through python subprocess module or vb script or using the Powershell ?
I have tried following code but it is not working
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
Error:
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.
Also tried below vb script but still no luck
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}"
User contributions licensed under CC BY-SA 3.0