Question

Locked

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
Next

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

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Desktop Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums