Update the Local Computer Policy in Windows 7 with IGroupPolicyObject

六眼飞鱼酱① 提交于 2019-12-13 16:35:56

问题


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.

In gpedit.msc:

Local Computer Policy/Computer Configuration/Administrative Templates/System/Removable Storage Access

ValueName: All Removable Storage classes: Deny all access

Value: 1 (set this to 1)

Local Computer Policy/Computer Configuration/Administrative Templates/Windows Components/AutoPlay Policies

ValueName: Turn off Autoplay

Value: 1 ( set this to 1)

I think the key is to use IGroupPolicyObject in C++. However, I can't find any documentation that I can wrap my head around.

My application needs to disable/enable all USB Access without having to reboot Windows 7.


回答1:


I think that these links will help you:

  • C/C++ with a fully described way to change a setting in LGPO: Pete's Blog - Programatically setting and applying Local Group Policies on Windows

  • C# code that alters LGPO object by ComImport mechanism Software Developer's Bytes - Group Policy Object via .NET\C#



来源:https://stackoverflow.com/questions/12926644/update-the-local-computer-policy-in-windows-7-with-igrouppolicyobject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!