【发布时间】:2015-09-15 11:37:09
【问题描述】:
我正在开发一个 VB.NET 应用程序来从本地系统获取 Bitlocker 信息。下面是我的代码。当我以管理员权限运行时,此代码完美运行并返回结果。但是在没有管理员权限的情况下运行时会出错。
Dim arEncryptionMethod = {"None", "AES 128 With Diffuser", "AES 256 With Diffuser", _
"AES 128", "AES 256"}
Dim arProtectionStatus = {"Protection Off", "Protection On", "Protection Unknown"}
Dim strComputer = "."
Dim colItems As New ManagementObjectSearcher("\\" & strComputer & _
"\root\CIMV2\Security\MicrosoftVolumeEncryption",
"Select * from Win32_EncryptableVolume " & "Where DriveLetter='C:'")
For Each objItem As ManagementObject In colItems.Get()
ListBox1.Items.Add("Volume:" & objItem("DriveLetter"))
ListBox1.Items.Add(" EncryptionMethod: " & arEncryptionMethod(objItem.InvokeMethod _
("GetEncryptionMethod", Nothing, Nothing)("EncryptionMethod")))
ListBox1.Items.Add(" ProtectionStatus: " & arProtectionStatus(objItem.InvokeMethod _
("GetProtectionStatus", Nothing, Nothing)("ProtectionStatus")))
Next
【问题讨论】: