Is it possible to apply (and remove) Windows group policy settings using .NET?
I am working on an application that needs to temporarily put a machine into a restricted, kiosk-like state. One of the things I need to control is access to USB drives which I believe I can do through group policy. I’d like my app to set the policy when it starts and revert the change when it exits… is this something I can do through .NET framework calls?
These are my primary requirements:
- Apply group policy settings when my console app is started.
- Identify when a user action is denied by the policy and log it.
- Logging to the system security log is acceptable.
- Revert my policy changes when my app stops.
Try using IGroupPolicyObject
You can call this function like this..