How do I configure group policies using C#?

2020-02-06 13:29发布

问题:

How can I manipulate group policy based restriction for the controlpanel and the taskmanager in C#?

回答1:

Have a look at WMI. Here is a link to an article on WMI Group policy objects: http://msdn.microsoft.com/en-us/library/aa375082(VS.85).aspx

This tool will generate example c# code for you:
WMICodeCreator



回答2:

you can use Registry key to restriction task manager and control panel easily!



回答3:

There is some information on how to edit GPO Registry settings available here: http://msdn.microsoft.com/en-us/library/aa374274(v=VS.85).aspx

There is also a good blog post here: http://blogs.msdn.com/b/dsadsi/archive/2009/07/23/working-with-group-policy-objects-programmatically-simple-c-example-illustrating-how-to-modify-a-registry-based-policy.aspx

The examples are in C++ but some clever person may be able to write a .net wrapper.



回答4:

This isn't a programming question, but a question of workstation policy management. Start looking at e.g. this.