Correct Script Set Fso = CreateObject(“Scripting.FileSystemObject”)
Set InputFile = fso.OpenTextFile(“MachineList.Txt”)
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
objExcel.Workbooks.Add intRow = 2
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine intRow = intRow +1
objExcel.Cells(1, 1).Value = “System Name”
objExcel.Cells(1, 2).Value = “Version”
Set objWMIService = GetObject(“winmgmts:” & strComputer & “rootcimv2”)
Set colFiles = objWMIService.ExecQuery _
    (“Select * from CIM_Datafile Where Name = ‘c:windowssystem32mshtml.dll'”) For Each objFile in colFiles
objExcel.Cells(intRow, 2).Value = objFile.Version
objExcel.Cells(intRow, 1).Value = strComputer
objExcel.Range(“A1:B1”).Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Next
loop
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range(“B1”)
objRange.Sort objRange,1,,,,,,1
‘ loop
MsgBox “Done”   Wrong Script     Set Fso = CreateObject(“Scripting.FileSystemObject”)
Set InputFile = fso.OpenTextFile(“MachineList.Txt”)
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = “System Name”
objExcel.Cells(1, 2).Value = “Version”
Set objWMIService = GetObject(“winmgmts:” & strComputer & “rootcimv2”)
Set colFiles = objWMIService.ExecQuery _
    (“Select * from CIM_Datafile Where Name = ‘c:windowssystem32mshtml.dll'”)
For Each objFile in colFiles
objExcel.Cells(intRow, 2).Value = objFile.Version
objExcel.Cells(intRow, 1).Value = strComputer objExcel.Range(“A1:B1”).Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Next
loop
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range(“B1”)
objRange.Sort objRange,1,,,,,,1
‘ loop
MsgBox “Done”

 

Leave a Reply