Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在本地系统中使用VB.NET中的WMI查询获取Bitlocker信息时拒绝访问_Vb.net_Wmi - Fatal编程技术网

在本地系统中使用VB.NET中的WMI查询获取Bitlocker信息时拒绝访问

在本地系统中使用VB.NET中的WMI查询获取Bitlocker信息时拒绝访问,vb.net,wmi,Vb.net,Wmi,我正在开发一个VB.NET应用程序,从本地系统获取Bitelocker信息。下面是我的代码。当我以管理员权限运行时,这段代码可以完美地运行并返回结果。但它在没有管理员访问权限的情况下运行时出错 Dim arEncryptionMethod = {"None", "AES 128 With Diffuser", "AES 256 With Diffuser", _ "AES 128", "AES 256"} Dim arProtectionStatus = {"Protection Off

我正在开发一个VB.NET应用程序,从本地系统获取Bitelocker信息。下面是我的代码。当我以管理员权限运行时,这段代码可以完美地运行并返回结果。但它在没有管理员访问权限的情况下运行时出错

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

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

更改默认值:

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


另一个注意事项是,当您打开此文件时,其中应该有注释,说明您可以将其更改为什么类型。

通过编辑应用程序下的
请求执行级别
为您的程序
管理员授予特权。您需要显示解决方案下的所有文件,请查找
app.manifest

更改默认值:

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


另一个注意事项是,当您打开此文件时,其中应该有注释,说明您可以将其更改为什么类型。

您好,谢谢您的回复。我已经试过了,如果我们将级别更改为“requireAdministrator”,当我们运行应用程序时,它将要求管理员凭据在用户帐户有限的系统中执行。请让我知道有没有其他方法可以做到这一点。我怀疑这是因为Bitlocker更安全。我可以使用除“Win32_EncryptableVolume”之外的所有其他类。您好,谢谢您的回复。我已经试过了,如果我们将级别更改为“requireAdministrator”,当我们运行应用程序时,它将要求管理员凭据在用户帐户有限的系统中执行。请让我知道有没有其他方法可以做到这一点。我怀疑这是因为Bitlocker更安全。我可以使用除“Win32_EncryptableVolume”之外的所有其他类。