tags:

views:

245

answers:

2

How can you shutdown a harddrive ? i want to do this to be able to safely remove my sata drive even though it's hotplug. WMI does't seems to have the method.

+2  A: 

Using WMI, you can get the 'eject drive' dialog to pop up using:

Shell "Rundll32.exe Shell32.dll Control_RunDLLA hotplug.dll", vbNormalFocus

Alternatively, if you want to programatically eject a device, you need this MSDN article. This should work with sata drives, if you can eject them manually then you'll be able to 'eject' them programatically.

gbjbaanb
the msdn article is insteresting
CiNN
This method has nothing to do with WMI -- it's just launching the safely remove hardware dialog.
Kasprzol
+2  A: 

Solution without any popping dialogs:

just use

sync

from cygwin (sync is utility from coreutils)

Oleksandr Bolotov