VBSCRIPT To find the free space and total space of a group of system
This script will read the INPUT file from the loacation and will find out the free space and total space of teh drives in the system and store it in OUTPUT.txt file.
The Input file should be having the server names one servername per line (line delimted).
Copy the file and save it as .vbs file and excute it after making sure that the INPUT.txt file is there. Also these servers needs to be reachable adn WMI should be avilable remotely. In short you should be having admin rights :)
==================================================================
Option Explicit
const strReport = "c:\OUTPUT.txt"
const sFile = "C:\INPUT.txt"
Dim objWMIService, objItem, colItems
Dim strDriveType, strDiskSize, txt
Dim oFSO, oFile, sText,strComputer
Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim objFSO,objTextFile
Set objFSO = createobject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(strReport)
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
sText = oFile.ReadLine
If Trim(sText) <> "" Then
strComputer=sText
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3")
txt = sText & vbtab & "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" & vbtab & "Free(%)" & vbcrlf
For Each objItem in colItems
DIM pctFreeSpace,strFreeSpace,strusedSpace
pctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10
strDiskSize = Int(objItem.Size /1073741824) & "Gb"
strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb"
strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb"
txt = txt & vbtab & vbtab & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace & vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlf
Next
objTextFile.Write(txt)
End If
Loop
objTextFile.Close
oFile.Close
Else
WScript.Echo "The file was not there."
End If
=======================================================
Hope tha this information will be helpful
Sudheesh Narayanaswamy