title: Win32 API P-Invoke to bring a disk online, offline, and set unique ID
body: <p>I am currently using Diskpart to accomplish these functions, but i would like to be able to use P-Invoke and not have to shell out to an external process in my C# app. </p>
  
  <p>The example Diskpart scripts are:</p>
  
  <pre><code>//Online a disk
  Select disk 7
  disk online
  
  // Reset GPT Identifier
  select disk 7
  UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee
  </code></pre>
  
  <p>I tried searching pinvoke.net but could only find functions that dealt with volumes, not disks. Any idea on how to accomplish these diskpart commands using Pinvoke?</p>