Appending to Excel document showing service status
I found a vb script that helps me with checking my servers online/offline status since Config Manager cant/doesnt represent clearly. What I want to do with the script is modify it so that it also tells me the status of the WDS service since I do have a few servers that fail to start WDS on reboot even though startup is automatic. I am not good with coding, I can understand the concept when it is in front of me but cannot execute it with much luck. I have modified it to create the Service Status but don't actually know how to query it. Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True intRow = 2 Set Fso = CreateObject("Scripting.FileSystemObject") Set objWorkbook = objExcel.Workbooks.Open("C:\SCCM\SCCM SERVER PING TEST\output.xls") Set InputFile = objWorkbook Do Until objExcel.Cells(intRow,1).Value = "" strComputer = objExcel.Cells(intRow, 1).Value objExcel.Cells(1, 1).Value = "Machine Name" objExcel.Cells(1, 2).Value = "IP Address" objExcel.Cells(1, 3).Value = "Status" objExcel.Cells(1, 4).value = "Service Status" On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems If Err.Number <> 0 Then objExcel.Cells(intRow, 2).Value = "" objExcel.Cells(intRow, 3).Value = "Off Line" objExcel.Cells(intRow, 3).Font.Bold = TRUE objexcel.Cells(intRow, 3).Font.ColorIndex = 3 objexcel.cells(intRow, 3).Interior.ColorIndex = 1 Err.Clear Else objExcel.Cells(intRow, 2).Value = objItem.IPAddress objExcel.Cells(intRow, 3).Value = "On Line" objExcel.Cells(intRow, 3).Font.Bold = TRUE objexcel.Cells(intRow, 3).Font.ColorIndex = 4 objexcel.cells(intRow, 3).Interior.ColorIndex = 1 End If Next intRow = intRow + 1 Loop objExcel.Range("A1:D1").Select objExcel.Selection.Interior.ColorIndex = 19 objExcel.Selection.Font.ColorIndex = 11 objExcel.Selection.Font.Bold = True objExcel.Cells.EntireColumn.AutoFit Set objWorkbook = Nothing MsgBox "Done"
July 11th, 2011 7:03pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics