Skip to main content
3 events
when toggle format what by license comment
Jan 9, 2013 at 23:59 comment added willy Assuming $diid is a string which holds the device instance ID of the HDD, $disks = gwmi win32_diskdrive | ? pnpdeviceid -eq $diid $c = @($disks).count if ($c -eq 1) { $diskid = $disks.index $dpscript = @" sel disk $diskid offline disk exit "@ $dpscript | diskpart } else { write-host "ERROR" }
Jan 9, 2013 at 23:48 comment added willy Thanks, but I found out that the serial number of a HDD isn't necessarily unique and that, even though collisions are probably rare, there is a better way to find the correct disk number.
Dec 31, 2012 at 22:19 history answered David Ruhmann CC BY-SA 3.0