Determine Free HDD Space available on Servers from batch or script

Hi I would like to develop a script that runs regulary and colates the free space avaialbale on each drive in each server I have. What fields and or methods ara available to to do this ?
The server environment is Win2k3
I can then colate the data in to  excel or a data base so I can monitor free space and when there are any significant changes to free space . Currently I have a batch file that basically does a dir listing on each drive then I have this recorded  manually into a spreadsheet but I want to automate the whole process.

Eventually I want something I can take with me to diffenet sites

EGCAsked:
Who is Participating?
 
RubalJCommented:
Hi,

I use following vbscript to do so. On might need to add server names to Servers() array.

Eg.
Servers(0) = "RUBAL1"
Servers(1) = "RUBAL2"

Thanks
Const PROCENTLIMIT = 10
Const HARD_DISK = 3
 
Dim Servers(100)
Servers(0) = "RUBAL1"
Servers(1) = "RUBAL2"
 
on error resume next
For Each s In Servers
If s <> "" Then
	strComputer = s
	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
	    FreeProcent = objDisk.FreeSpace * 100 / objDisk.Size
	    If FreeProcent < PROCENTLIMIT Then
		Set objEmail = CreateObject("CDO.Message")
	
		objEmail.From = "Rubal@Rubal.Net"
		objEmail.To = "Rubal@Rubal.Net"
		objEmail.Subject = strComputer & " low space" 
		objEmail.Textbody = objDisk.DeviceID & " low space " & round((objDisk.FreeSpace / 1024 / 1024 / 1024), 2) & " GB free"
		objEmail.Send
	    End If
	Next
End if
Next

Open in new window

0
 
bsharathCommented:
Hi,

Try Spiceworks that tools does the job...
0
 
bsharathCommented:
See this by Rob excellent way to get space
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_22904813.html#discussion

Take the computers.txt file over the vbs file it will get all the diskspace of all the machines to different csv files then use the converter to get all data to 1 sheet.
0
 
bsharathCommented:
You can download it from here
http://www.spiceworks.com/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.