我想使用 WMI 从 UWF 中获取所有注册表排除和文件排除。
我已经尝试从 UWF_RegistryFilter 类调用 GetExclusions 方法,但没有成功。
我期待着一个工作示例代码,提前感谢您的帮助!
困难的部分是从方法结果中读取输出参数。没有适当的文档可用于微软网站并且很难猜测如何利用 ManagementBaseObject 来读取输出参数。
为了找到解决方案,我尝试根据其他有据可查的 wmi 示例来了解 WMI 如何使用输出参数。请使用下面的C#代码,希望对您有所帮助:
public static void GetRegistryExclusions()
{
ManagementScope scope = new ManagementScope(@"root\standardcimv2\embedded");
using (ManagementClass mc = new ManagementClass(scope.Path.Path, "UWF_RegistryFilter",
null))
{
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
ManagementBaseObject[] result = (ManagementBaseObject[])mo.InvokeMethod("GetExclusions", null, null).Properties["ExcludedKeys"].Value;
if (result != null)
{
foreach (var r in result)
{
Console.WriteLine(r.GetPropertyValue("RegistryKey"));
}
}
}
}
}
注意/要求请求某人与1500 声望创建并链接以下标签,以便像我这样的人可以更轻松地在 stackoverflow 上请求解决方案/回答问题。
- UWF
- UWFMGR
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)