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

By brood ·
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

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

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums