【问题标题】:Access Denied while fetching Bitlocker Information using WMI Query in VB.NET in Local system在本地系统中使用 VB.NET 中的 WMI 查询获取 Bitlocker 信息时访问被拒绝
【发布时间】: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

【问题讨论】:

    标签: vb.net wmi


    【解决方案1】:

    通过编辑您的应用程序下的RequestedExecutionLevel 来授予您的程序Administrator 权限。您需要显示解决方案下的所有文件,查找app.manifest

    更改默认值:<requestedExecutionLevel level="asInvoker" uiAccess="false" />

      <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
    

    另外,当您打开此文件时,其中应该有说明您可以将其更改为哪些类型的注释。

    【讨论】:

    • 您好,感谢您的回复。我已经尝试过了,问题是如果我们将级别更改为“requireAdministrator”,当我们运行应用程序时,它将要求管理员凭据在用户帐户受限的系统中执行。请让我知道有没有其他方法可以做到这一点。我怀疑这是由于 Bitlocker 更安全的性质。我可以使用除“Win32_EncryptableVolume”之外的所有其他类。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 1970-01-01
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多