2010-08-12 202 views

回答

-1

编辑:找到了更好的答案。

实际上有一个名为Win32_EncryptableVolume的WMI类,可能很可能用于以一种很好的方式来完成此操作。它有一个可能有用的Decrypt方法。下面这里

在Windows 7

旧的答案,看看工具manage-bde.exe,在Vista看剧本manage-bde.wsf

假设他们可以做你想做的事,你应该可以用你的.Net应用程序中的相关参数调用它们。

+0

我不需要解密,只是暂停。我会检查WMI类是否有这种方法。 – 2010-08-12 12:46:46

+0

@Andrew:是的,我不太了解BitLocker,所以不确定你需要什么。虽然考虑它,也许它是'DisableAutoUnlock',你需要? – 2010-08-12 12:58:42

+0

PowerShell似乎并不知道Win32_类。 – 2010-08-12 13:48:10

0

命令行:

manage-bde -protectors -disable <drive letter>: 
manage-bde -protectors -enable <drive letter>: 

Powershell的(WMI)

$bitlocker = Get-WmiObject -Namespace root\cimv2\Security\MicrosoftVolumeEncryption -Class Win32_EncryptableVolume 
$bitlocker.DisableKeyProtectors() 
$bitlocker.EnableKeyProtectors() 

C#

using System.Management // add reference 
// ... 

// disable Bitlocker 
ManagementObject classInstance = new ManagementObject(@"root\cimv2\Security\MicrosoftVolumeEncryption", "Win32_EncryptableVolume.DriveLetter='C:'", null); 
ManagementBaseObject outParams = classInstance.InvokeMethod("DisableKeyProtectors", null, null); 

// enable Bitlocker 
outParams = classInstance.InvokeMethod("EnableKeyProtectors", null, null); 
相关问题