使用IGroupPolicyObject更新Windows 7中的本地计算机策略 [英] Update the Local Computer Policy in Windows 7 with IGroupPolicyObject
问题描述
我只想能够以编程方式执行gpedit.msc
的工作.我正在尝试将这些键的值设置为1并更新本地组注册表.
I just want to be able to programmatically do what gpedit.msc
does. I'm trying to set the value of these keys to 1 and Update the Local Group Registry.
在gpedit.msc中:
本地计算机策略/计算机配置/管理模板/系统/可移动存储访问
ValueName::所有可移动存储类:拒绝所有访问
ValueName: All Removable Storage classes: Deny all access
值:1(将此设置为1)
Value: 1 (set this to 1)
本地计算机策略/计算机配置/管理模板/Windows组件/自动播放策略
ValueName :关闭自动播放
值: 1(将其设置为1)
Value: 1 ( set this to 1)
我认为关键是要在C ++中使用IGroupPolicyObject
.但是,我找不到任何可以整理的文档.
I think the key is to use IGroupPolicyObject
in C++. However, I can't find any documentation that I can wrap my head around.
我的应用程序需要禁用/启用所有USB访问,而不必重新启动Windows 7.
My application needs to disable/enable all USB Access without having to reboot Windows 7.
推荐答案
我认为这些链接将为您提供帮助:
I think that these links will help you:
-
C/C ++,具有在LGPO中更改设置的完整描述的方法: Pete的博客-在Windows上以编程方式设置和应用本地组策略
C# code that alters LGPO object by ComImport mechanism Software Developer's Bytes - Group Policy Object via .NET\C#
这篇关于使用IGroupPolicyObject更新Windows 7中的本地计算机策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!