Adding a summary report and disk information to VB Script

Kendra

New Member
I was hoping someone could help me with this code. I wanted to add two things to this script but can't seem to get it working at all. The script works fine but what isn't working is trying to add the disk information and trying to create a summary report for total size of disk. at the end of it I'm trying to make an output of what \[code\]wmic diskdrive list brief /format:list\[/code\]would give you. something like this:\[code\]Caption=WDC WD2500BEKT-75PVMT1DeviceID=\\.\PHYSICALDRIVE0Model=WDC WD2500BEKT-75PVMT1Partitions=1Size=250056737280\[/code\]Here is the script so far\[code\]Option Explicitconst strComputer = "."const strReport = "c:\path\to\file"Dim objWMIService, objItem, colItems Dim strDriveType, strDiskSize, txtSet objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3")txt = "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" & vbtab & "Free(%)" & vbcrlfFor Each objItem in colItemsDIM pctFreeSpace,strFreeSpace,strusedSpacepctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10strDiskSize = Int(objItem.Size /1073741824) & "Gb"strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb"strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb"txt = txt & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace & vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlfNextwriteTextFile txt, strReportwscript.echo "Report written to " & strReport & vbcrlf & vbcrlf & txt' Procedure to write output to a text fileprivate sub writeTextFile(byval txt,byval strTextFilePath)Dim objFSO,objTextFileset objFSO = createobject("Scripting.FileSystemObject")set objTextFile = objFSO.CreateTextFile(strTextFilePath)objTextFile.Write(txt)objTextFile.CloseSET objTextFile = nothingend sub\[/code\]
 
Top