title: How to apply Windows group policy using .NET?
body: <p>Is it possible to apply (and remove) Windows group policy settings using .NET? </p>
  
  <p>I am working on an application that needs to <em>temporarily</em> 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?</p>
  
  <p><strong>These are my primary requirements:</strong></p>
  
  <ul>
  <li>Apply group policy settings when my console app is started.</li>
  <li>Identify when a user action is denied by the policy and log it.
  
  <ul>
  <li>Logging to the system security log is acceptable.</li>
  </ul></li>
  <li>Revert my policy changes when my app stops. </li>
  </ul>