Looking for a script that will report folder size from multiple computers - TechRepublic
Question
February 12, 2007 at 12:30 PM
brood

Looking for a script that will report folder size from multiple computers

by brood . Updated 19 years, 4 months ago

I need a vbs script that will report the size of a folder on multiple computers. I have a script that will report this information when ran on a single computer.

What I would like to do is to have this script read from a list of computers and then append another txt file with the computer names and folder sizes. I am not sure how to add the read section to this.

Currently the script only appends a document. Here is what I have so far…

On Error Resume Next
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFolder = objFSO.GetFolder(“C:\folder”)
strSize = (objFolder.Size/1024)
strKB = FormatNumber(strSize, 2)
Const ForAppending = 8

strComputer = “.”
Dim objComputer
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
Set colSettings = objWMIService.ExecQuery _
(“Select * from Win32_ComputerSystem”)
For Each objComputer in colSettings
strComputerName = objComputer.Name
Next

Set objFile = objFSO.OpenTextFile(“\\Server\Share\Foldersize.txt”, ForAppending)
objFile.WriteLine strComputerName & ” ” & strKB & ” KB”
objFile.Close

This discussion is locked

All Comments