![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | diskspace on Exchange Servers I have a script here to check diskspace but its all over the place unfortunately. I am trying to only query the E, G and I drives of a list of servers. Some of these servers have only E and G drives whilst others have E, G and I drives. Basically these are exchange log areas and we are trying to keep an eye out on the diskspace so it does not run out on a daily report. If any one can help I would appreciate it please. The script is below which at the moment list percents and all drive letters at the begining but I need to maybe put a case statement in to only check for the needed drive letters and how to read the list of servers in through a text file outputting drive letter such as E: freespace nnnn percent free Thanks. Simon ----------------------------------------------------------------- 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 'to get GB size, divide by 1073741824 (same as dividing space by ' 1024 / 1024 / 1024) strDiskDrive = objDisk.DeviceID strDiskUsed = FormatNumber((objDisk.Size - objDisk.FreeSpace) / 1073741824) strDiskSize = FormatNumber(objDisk.Size / 1073741824,2) strDiskFree = FormatNumber(objDisk.Freespace / 1073741824,2) strPercFree = FormatNumber(objDisk.FreeSpace/ objDisk.Size,2) strPercFree = strPercFree * 100 'multiply percent by 100 to get whole number wscript.echo strComputer & vbtab & " " & strDiskDrive & " " & strPercFree & "% free." Next For Each objDisk in colDisks Wscript.Echo "DeviceID: "& vbTab & objDisk.DeviceID Wscript.Echo "Free Disk Space: "& vbTab & objDisk.FreeSpace/ 1048576 Next wscript.echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" For Each objDisk in colDisks If objDisk.DeviceID = "E:" Then 'wscript.Echo objDisk.DeviceID & vbtab & objDisk.FreeSpace/1048576 mynum=objDisk.Freespace Myroundnum=Int(mynum/1048576)+1 wscript.Echo objDisk.DeviceID & vbtab & Myroundnum End if If objDisk.DeviceID = "G:" Then mynum=objDisk.Freespace Myroundnum=Int(mynum/1048576)+1 wscript.Echo objDisk.DeviceID & vbtab & Myroundnum End If If objDisk.DeviceID = "I:" Then mynum=objDisk.Freespace Myroundnum=Int(mynum/1048576)+1 wscript.Echo objDisk.DeviceID & vbtab & Myroundnum End If Next |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| diskspace on shares | VB Script | |||
| configuring the diskspace bar from the drive tile | General Discussion | |||
| Diskspace cleanup = strange problem | General Discussion | |||
| Finding Exchange 2003 Servers in AD | PowerShell | |||
| Diskspace growing 1 GB/day (or more) | Vista General | |||