This forum is closed. Thank you for your contributions.
Hi guys,
Is there any way to programmatically detect if a disk/drive is in the server storage pool or not? Thanks
Yes, there are a number of ways to do this. The easiest method is to use the published SDK to get a list of IDiskInfo objects: http://msdn.microsoft.com/en-us/library/microsoft.homeserver.sdk.interop.v1.whsinfoclass.getdiskinfo.aspx.
The Status property on IDiskInfo is an enum that gives you basic health status of the disk: http://msdn.microsoft.com/en-us/library/microsoft.homeserver.sdk.interop.v1.whsdiskstatus.aspx. A few of those states are transitory (like INITIALIZED), but the one you want is WHS_DISK_UNKNOWN (which usually indicates the disk isn't part of the storage pool).
I found that I needed much more accuracy than what IDiskInfo provides, so I ended up using unpublished methods in QSMMgr (break out Reflector).