WMI New Disks in Windows 2008 R2 comes with state OFFLINE change via WMI from OFFLINE to ONLINE state
New Disks comes in Windows 2008 and Windows 2008 R2 as offline. it's possible to change that via WMI Method to online ? Or I have really to use diskpart like: select disk 2 online disk thanks kind regards, Sw
July 28th, 2010 4:16pm

bump
Free Windows Admin Tool Kit Click here and download it now
July 31st, 2010 1:18pm

hi , can you check the below API and post back. http://msdn.microsoft.com/en-us/library/ff567016%28VS.85%29.aspx
August 2nd, 2010 10:35am

hi, there is nothing inside this link, that handle this problem. Because Windows 2008 and Windows 2008 R2 handles "new" disks other then W2003. And the disks will show as offline, if you map it. After that you have to set the this as online then Windows will read the partition and maps the drive letter etc. So this WMI classes always handle steps deeper to map the drives to windows, but no one to set the disk after mapping in "online" status. That's a really need to can handle that status. And not only with diskpart ! thanks kind regards, Mathias
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2010 10:52am

You could change it on the servers so that they don't default to Offline. To do this: Open up a command prompt using "Run As Administrator" Type diskpart Type san If it is currently says SAN Policy : Offline Shared then you will need to type the following to resolve this: SAN POLICY=OnlineAll
October 14th, 2010 7:25pm

This is an excellent suggestion, but even with the SAN policy set to OnlineAll new drives presented via iSCSI to the 2008R2 server do not automatically mount - they still have to be manually brought online using diskpart. So I too am looking for a WMI option. Anyone?
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2010 9:40pm

This is an old post, but in case anyone came across this in Google (which I have) : You will be better off doing this in C. I know many people would rather use WMI because they can do this through powershell or c# but the best approach might be to write a wrapper in C then import the DLL into your project. Typically when you are adding and removing disks from a server, it is an iSCSI disk or VHD. I have a solution for the case where a VHD is mounted. Microsoft has provided a few great tools for those using C++. You can not only set a disk online and create a disk, but also get the disk information and attach the disk. You can do most of this using the IVdsInterface. The IVdsInterface exposes SetStatus that can be used to set the disk online or offline. To do this, install the windows SDK and check out the vds.h file in the includes folder. Hope this helps, because I am working on the same thing, but the new disks come to windows in the form of cloned mounted VHD files.
September 30th, 2011 6:44pm

This is an old post, but in case anyone came across this in Google (which I have) : You will be better off doing this in C. I know many people would rather use WMI because they can do this through powershell or c# but the best approach might be to write a wrapper in C then import the DLL into your project. Typically when you are adding and removing disks from a server, it is an iSCSI disk or VHD. I have a solution for the case where a VHD is mounted. Microsoft has provided a few great tools for those using C++. You can not only set a disk online and create a disk, but also get the disk information and attach the disk. You can do most of this using the IVdsInterface. The IVdsInterface exposes SetStatus that can be used to set the disk online or offline. To do this, install the windows SDK and check out the vds.h file in the includes folder. Hope this helps, because I am working on the same thing, but the new disks come to windows in the form of cloned mounted VHD files.
Free Windows Admin Tool Kit Click here and download it now
October 1st, 2011 1:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics