Win32 API P-Invoke to bring a disk online, offline, and set unique ID

Posted by Andy Schneider on Stack Overflow See other posts from Stack Overflow or by Andy Schneider
Published on 2010-05-25T15:10:07Z Indexed on 2010/05/25 15:11 UTC
Read the original article Hit count: 394

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about pinvoke