BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| VBS Script To Determine If Machines Are Clients And Send The Results To Excel |
 |
|
|
By: Don Hite
Posted On: 11/20/2008
This VBS Script will allow you to enter a site server name and site code and will write all of the resource names found to an Excel spreadsheet and if the resources are not clients the results will be written in red.
VBS Script:
strComputer = InputBox ("Enter Site Server Name") strSiteCode = InputBox ("Enter Site Code")
Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name" objExcel.Cells(1, 2).Value = "Client"
Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode) Set colItems = objWMIService.ExecQuery ("Select * From SMS_R_System") For Each objItem in colItems
objExcel.Cells(intRow, 1).Value = objItem.Name If objItem.Client = 1 Then objExcel.Cells(intRow, 2).Value = "Yes" Else objExcel.Cells(intRow, 2).Value = "No" End If
If objExcel.Cells(intRow, 2).Value = "No" Then objExcel.Cells(intRow, 1).Font.ColorIndex = 3 objExcel.Cells(intRow, 2).Font.ColorIndex = 3 End If 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"
|
 |
 |
 |
|
|