[英]How to know if UWF is enabled or disabled
How do I know if the UWF is enabled or disabled?我如何知道 UWF 是启用还是禁用? I'm making an application with C # so I need to know for that language.我正在使用 C# 制作应用程序,因此我需要了解该语言。
Thank you谢谢
There are few things to keep in mind when considering whether UWF is enabled or disabled:在考虑 UWF 是启用还是禁用时,有几件事需要牢记:
The C# code below demonstrates the use of CurrentEnabled property of UWF_Filter class:下面的 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;
}
Note/Request : Request someone with 1500 reputation to create and link following tags so that it becomes easier for people like me to request solutions/answer questions on stackoverflow.注意/请求:请求具有1500 声望的人创建并链接以下标签,以便像我这样的人更容易在 stackoverflow 上请求解决方案/回答问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.