Win32 API P-Invoke to bring a disk online, offline, and set unique ID
- by Andy Schneider
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.
The example Diskpart scripts are:
//Online a disk
Select disk 7
disk online
// Reset GPT Identifier
select disk 7
UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee
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?