First I should say, I've tried to do this and I just don't get it. I'm not a programmer, I'm just an administrative person that has been tasked with something totaly new and unknown. (Programming VBScript.) I've done a little html code for simple things but this is overwhelming.
I've been asked to give the amount of free disk space on all the server computers in the form of a report. That's 63 server computers.
I figured out how to get the drive space from remote computers in pop up windows (with help). I keep changeing the server computer name in the VBScript to get each server computers free disk space. I've been doing this for about a month. (This works but takes a long time.)
I learned to create a text file in VBScript then write to the same file and save it.
I know a file can be used as a list with all the server computer names in it and that it can be processed to get each server computers free disk space.
I know a file with the output can be created and saved.
I just can't get from Point A ---> B.
I've been working on this for a week in my spare time both at home and at work. I really need to spend less time doing this task every day. I know I should just keep working at it but I don't get how to put the parts together.
I've been asked to give the amount of free disk space on all the server computers in the form of a report. That's 63 server computers.
I figured out how to get the drive space from remote computers in pop up windows (with help). I keep changeing the server computer name in the VBScript to get each server computers free disk space. I've been doing this for about a month. (This works but takes a long time.)
Code:
Const HARD_DISK = 3
strComputer = "print1"
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
Wscript.Echo "Drive: "& vbTab & objDisk.DeviceID
Wscript.Echo "Free Space: "& vbTab & objDisk.FreeSpace
Next
I learned to create a text file in VBScript then write to the same file and save it.
Code:
"creatfile.vbs"
Dim fso, crfile
set fso = CreateObject("Scripting.FileSystemObject")
set crfile=fso.CreateTextFile("c:\samsvbs\test.txt")
"writefile.vbs"
Const ForWriting=2
Dim fso, wrfile
Set fso=CreateObject("scripting.FileSystemObject")
Set wrfile=fso.OpenTextFile("c:\samsvbs\test.txt",ForWriting)
wrfile.Write("This worked")
wrfile.Close
"create-write-file.bat"
createfile.vbs
writefile.vbs
I know a file with the output can be created and saved.
I just can't get from Point A ---> B.
I've been working on this for a week in my spare time both at home and at work. I really need to spend less time doing this task every day. I know I should just keep working at it but I don't get how to put the parts together.