Windows Cluster - Determine disk usage with Win32_LogicalDisk

I need to monitor the disk usage in a Active/Passive Win 2003/SQL server cluster; 2 boxes one is active and one is passive.  I have an executeable that uses "SELECT * From Win32_LogicalDisk" to get disk information. This works just fine on other Win 2003 Servers and XP boxes.  However, when running this in the cluster, no disk information is returned.

Each cluster box has a C: and a D: drive, then it shares some Powervault drives.  I know very little about how the cluster works, but I would expect to at least get info on the C: and D: drives.

Does anyone have any ideas?  Thanks.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Here is a script that monitors local disk space from a list of servers from a file called input.txt and writes the info out to a CSV file DiskReport.csv.

Const HARD_DISK = 3
InputFile = "Input.txt" ' defines name and path of file
OutPutFile = "DiskReport.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInputFile = objFSO.OpenTextFile(InputFile) ' opens text file object
Set objOutputFile = objFSO.CreateTextFile(OutputFile)
objOutputFile.WriteLine "Computer Name," & "Device," & "Free Disk Space"
Do Until objInputFile.AtEndOfStream          ' sets beginning of loop to process all servers listed in input file
strComputer = (objInputFile.Readline)
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
For Each objDisk in colDisks
    WScript.Echo "Computer Name: " & vbtab & strComputer
    Wscript.Echo "DeviceID: "& vbTab &  objDisk.DeviceID       
    Wscript.Echo "Free Disk Space: "& vbTab & objDisk.FreeSpace/1024/1024/1024
    objOutputFile.Writeline strComputer & "," & objDisk.DeviceID & "," & objDisk.FreeSpace/1024/1024/1024

Open in new window

hexvaderAuthor Commented:
I essentially have this, except i am using an executable (C#.NET, .NET 1.1) and do not specifily the drive type.  I write this to an XML file.

What I am looking for is more information on a windows cluster such as how it manages disk drives and why the "Select * from Win32_LogicalDisk" does not return any information. I am able to get memory and CPU information;  "SELECT * From Win32_OperatingSystem" and "SELECT * From Win32_Processor" respectively. I find it odd not to get the disk info.

Any other ideas?

Ted BouskillSenior Software DeveloperCommented:
Clusters use a shared virtual drive.  What that means is that both servers are connected to the drive with the Active server having full control.  When the passive server becomes 'Active' it takes ownership of the drive.
hexvaderAuthor Commented:
Thanks for all the hints.  I finally figured things out. The "Win32_LogicalDisk" select works just fine. The code had to know which box was active and which was passive, then handle the results properly.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.