Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Determine Free HDD Space available on Servers from batch or script

Posted on 2007-11-30
4
Medium Priority
?
530 Views
Last Modified: 2013-12-06
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

0
Comment
Question by:EGC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 11

Expert Comment

by:bsharath
ID: 20381065
Hi,

Try Spiceworks that tools does the job...
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20381071
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
 
LVL 11

Expert Comment

by:bsharath
ID: 20381079
You can download it from here
http://www.spiceworks.com/
0
 
LVL 10

Accepted Solution

by:
RubalJ earned 2000 total points
ID: 20676852
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

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question