ave the following code in a text file and "Save As" in '.vbs' extension. Then double click on the .vbs file to get free space information of all drives:
'***Code Starts Here+++
On Error Resume Next
Dim strComputer
Dim objWMIService
Dim colItems
strComputer = "."
Set objWMIService = GetObject( "winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( "SELECT Freespace,DeviceID FROM Win32_LogicalDisk",,48)
For Each objItem in colItems
WScript.Echo "Drive Name: " & objItem.DeviceID & vbCrLf & "FreeSpace: " & ROUND((objItem.Freespace / (1024 * 1024 * 1024)),2) & " GB"
Next
'***Code Ends Here---
Wednesday, December 16, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment