In a previous post entitled “Write SMS Component Info To Excel VB Script” I showed how you could send the results of the Control Panels ‘System Management’ applets ‘System Management properties’ components tab to a Microsoft Excel spreadsheet using the input box to enumerate a specific machine.
Here is an example of how to grab the same information but write the results to a text file that will be placed in the same directory from which the script is executed from.
Vbs Script:
Dim oCPAppletMgr
Dim oClientComponents
Dim oClientAction
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("Results.txt", True)
strComputer = InputBox("Enter Machine Name To Query")
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr", strComputer )
Set oClientComponents = oCPAppletMgr.GetClientComponents()
For Each oOption In oClientComponents
objTextFile.WriteLine("Machine Name: " & strComputer)
objTextFile.WriteLine("Component: " & oOption.DisplayName)
objTextFile.WriteLine("Version: " & oOption.Version)
Select Case oOption.State
Case 0 objTextFile.WriteLine "State: Installed"
Case 1 objTextFile.WriteLine "State: Enabled"
Case Else objTextFile.WriteLine "State: Unknown"
End Select
objTextFile.WriteLine("")
Next
objTextFile.Close
Wscript.echo "Done!"
No Comments