[英]How to know if UWF is enabled or disabled
我如何知道 UWF 是啟用還是禁用? 我正在使用 C# 制作應用程序,因此我需要了解該語言。
謝謝
在考慮 UWF 是啟用還是禁用時,有幾件事需要牢記:
下面的 C# 代碼演示了 UWF_Filter 類的CurrentEnabled屬性的使用:
public static bool IsEnabled()
{
try
{
//root\standardcimv2\embedded
ManagementScope scope = new ManagementScope(@"root\standardcimv2\embedded");
using (ManagementClass mc = new ManagementClass(scope.Path.Path, "UWF_Filter",
null))
{
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
// Please make use of NextEnabled property in case you have enabled the UWF_Filter in the current session.
//The value in CurrentEnabled is populated only when the UWF_Filter was enabled on system boot.
return (bool)mo.GetPropertyValue("CurrentEnabled");
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
throw;
}
return false;
}
注意/請求:請求具有1500 聲望的人創建並鏈接以下標簽,以便像我這樣的人更容易在 stackoverflow 上請求解決方案/回答問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.