VBS Script To Enumerate MOM 2005 Computer Group Names And Send To Excel

 

This VBS script will allow you to enter a MOM 2005 server name into an input dialog box and it will then write the computer group names to an excel spreadsheet and enumerate whether or not they are enabled.

 

VBS Script:

 

strComputer = InputBox ("Enter MOM Server Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Computer Group"

objExcel.Cells(1, 2).Value = "Enabled"

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MOM")

Set colItems = objWMIService.ExecQuery("Select * from MSFT_ComputerGroup")

For Each objItem in colItems

 

objExcel.Cells(intRow, 1).Value = objItem.Name

objExcel.Cells(intRow, 2).Value = objItem.IsEnabled

intRow = intRow + 1

Next

 

objExcel.Range("A1:B1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("A1")

objRange.Sort objRange,1,,,,,,1

 

MsgBox "Done"

 

 

Published Sunday, August 12, 2007 8:03 AM by dhite
Filed under:

Comments

No Comments