📜 VBScript (WSH)
Get Computer System Product Info Report to File (VBScript)
Queries Win32_ComputerSystemProduct via WMI and writes Computer System Product Info to a timestamped text file, handy for scheduled logon/logoff scripts.
GetComputerSystemProductReportToFile.vbs
' ============================================================
' GetComputerSystemProductReportToFile.vbs
'
' Reports Computer System Product Info via WMI (Win32_ComputerSystemProduct) and writes the results to a
' timestamped text file next to this script.
'
' Usage: cscript GetComputerSystemProductReportToFile.vbs
' ============================================================
Option Explicit
Dim objWMIService, colItems, objItem
Dim objFSO, objFile, strOutPath, itemCount
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT Name, Vendor, Version, IdentifyingNumber FROM Win32_ComputerSystemProduct")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strOutPath = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\computersystemproduct-report_" & _
Replace(FormatDateTime(Now, 2), "/", "-") & ".txt"
Set objFile = objFSO.CreateTextFile(strOutPath, True)
itemCount = 0
For Each objItem In colItems
objFile.WriteLine "Name: " & objItem.Name
objFile.WriteLine "Vendor: " & objItem.Vendor
objFile.WriteLine "Version: " & objItem.Version
objFile.WriteLine "IdentifyingNumber: " & objItem.IdentifyingNumber
objFile.WriteLine String(40, "-")
itemCount = itemCount + 1
Next
objFile.Close
WScript.Echo itemCount & " Computer System Product Info written to: " & strOutPath