Greetings,

I'm using the following script to check drive sizes on various servers. The
problem is that our servers also have drives mounted in directories where
they don't have drive letters, eg:

C:\ (10 GB drive)
C:\subdrive (25 GB drive)
C:\subdrive\anothersub (15 GB drive)

When I execute the script below it only displays the drives with drive
letters.

Any ideas?

Thanks

---

Const HARD_DISK = 3
strComputer = "."

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 "Device ID: " & objDisk.DeviceID
Wscript.Echo "Free Disk Space: " & objDisk.FreeSpace
Next

---

RE: drive size for drives without drive letters by jefrie

jefrie
Wed Feb 22 07:20:26 CST 2006

Hello,

maybe you should use Win32_MountPoint instead of Win32_LogicalDisk
This is the code, but i just copied it ! Hope it will help you.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_MountPoint")

For Each objItem In colItems
WScript.Echo "Directory: " & objItem.Directory
WScript.Echo "Volume: " & objItem.Volume
WScript.Echo
Next

--
Jens Frieben (Germany)


"sneaky" wrote:

> Greetings,
>
> I'm using the following script to check drive sizes on various servers. The
> problem is that our servers also have drives mounted in directories where
> they don't have drive letters, eg:
>
> C:\ (10 GB drive)
> C:\subdrive (25 GB drive)
> C:\subdrive\anothersub (15 GB drive)
>
> When I execute the script below it only displays the drives with drive
> letters.
>
> Any ideas?
>
> Thanks
>
> ---
>
> Const HARD_DISK = 3
> strComputer = "."
>
> 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 "Device ID: " & objDisk.DeviceID
> Wscript.Echo "Free Disk Space: " & objDisk.FreeSpace
> Next
>
> ---
>
>
>
>