Perform a WQL Query (VBScript)
This code can be found in
Chapter 14 of DNS on Windows Server 2003
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' Perform a WQL query for the disks with less than 100MB free space
' ---------------------------------------------------------------
' From the book "DNS on Windows Server 2003"
' By Cricket Liu, Matt Larson & Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00562-8
' Book web site: http://rallenhome.com/books/dnsonw2k3/toc.html
' ---------------------------------------------------------------
strComputer = "."
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objDisks = objWMI.ExecQuery _
("select * from Win32_LogicalDisk " & _
"where FreeSpace < 104857600 " & _
"and filesystem = 'NTFS' ")
for each objDisk in objDisks
Wscript.Echo "DeviceID: " & objDisk.DeviceID
Wscript.Echo "Description: " & objDisk.Description
Wscript.Echo "FileSystem: " & objDisk.FileSystem
Wscript.Echo "FreeSpace: " & objDisk.FreeSpace
next
|
This code has been viewed 1831 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|