How to set software restriction policies programmatically
I would like to add software restriction policies programmatically using c#. For example: Add and additional rule to disallows paint.exe to ru开发者_开发知识库n.
Unfortunately I don't have the slightest idea how I could achieve this in c#
you can use the RSoP WMI classes with WMICodeCreator to update the group policy.
you could also exec gpupdate.exe directly or tweak the registry.
these xml policies can be useful:
http://www.microsoft.com/downloads/details.aspx?FamilyID=18c90c80-8b0a-4906-a4f5-ff24cc2030fb&displaylang=en
IGroupPolicyObject - Windows API to create/update policies programmatically.
I would recommend you to go through this links, they will explain in deep about accessing Group Policies programmatically.
Working with Group Policy Objects Programmatically
Programmatically updating local policy in Windows
If you have any other query, do ask.
The function requires 3 pieces of information:
- ADsPath to the GPO object to modify A mode control values, 0=Not
- Configured, 1=Enabled, 2=Disabled The actual value to write in the
- Key that represents the mode control value.
精彩评论