Hello all,
I'm not a programmer and I do not know VB at all. I found the following script on Windows Script Center and have found it very useful. It searches a computer for all Windows hotfixes and creates a Word document with the results.
I'd like to change the script if possible and have it create an Excel spreadsheet with the data. Can anyone help me or point me in what direction to go.
I'm guessing I need to change Set objWord = CreateObject("Word.Application") to Set objExcel = objExcel.Workbooks.Add()
set objSel = objExcel.Selection
But that doesn't seem to work. Anyone ever attempted this?
strComputer = "computername"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering")
'Create Word Object
Set objWord = CreateObject("Word.Application")
objWord.Caption = strComputer
objWord.Visible = True
' Create new Document
Set objDoc = objWord.Documents.Add()
set objSel = objWord.Selection
objSel.TypeText "Machine Name: " & strComputer
objSel.TypeParagraph()
For Each objQuickFix in colQuickFixes
If objQuickFix.Description <> "" Then
objSel.TypeText "Description: " & objQuickFix.Description
objSel.TypeParagraph()
objSel.TypeText "Hot Fix ID: " & objQuickFix.HotFixID
objSel.TypeParagraph()
objSel.TypeText "Installation Date: " & objQuickFix.InstallDate
objSel.TypeParagraph()
objSel.TypeText "Installed By: " & objQuickFix.InstalledBy
objSel.TypeParagraph()
End If
Next
I'm not a programmer and I do not know VB at all. I found the following script on Windows Script Center and have found it very useful. It searches a computer for all Windows hotfixes and creates a Word document with the results.
I'd like to change the script if possible and have it create an Excel spreadsheet with the data. Can anyone help me or point me in what direction to go.
I'm guessing I need to change Set objWord = CreateObject("Word.Application") to Set objExcel = objExcel.Workbooks.Add()
set objSel = objExcel.Selection
But that doesn't seem to work. Anyone ever attempted this?
strComputer = "computername"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering")
'Create Word Object
Set objWord = CreateObject("Word.Application")
objWord.Caption = strComputer
objWord.Visible = True
' Create new Document
Set objDoc = objWord.Documents.Add()
set objSel = objWord.Selection
objSel.TypeText "Machine Name: " & strComputer
objSel.TypeParagraph()
For Each objQuickFix in colQuickFixes
If objQuickFix.Description <> "" Then
objSel.TypeText "Description: " & objQuickFix.Description
objSel.TypeParagraph()
objSel.TypeText "Hot Fix ID: " & objQuickFix.HotFixID
objSel.TypeParagraph()
objSel.TypeText "Installation Date: " & objQuickFix.InstallDate
objSel.TypeParagraph()
objSel.TypeText "Installed By: " & objQuickFix.InstalledBy
objSel.TypeParagraph()
End If
Next