HTA Script To Emulate The SMS Consoles All Systems Collection Information

 

This HTA script will take an SMS site server name as well as its site code via input boxes and will write the following results to the active window based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001): Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.

 

Name

Resource Class

Domain

Site Code

Client

Assigned

Type

Obsolete

Active

ABC1

System

Domain

XXX

Yes

Yes

Advanced

No

Yes

ABC2

System

Domain

XXX

Yes

Yes

Advanced

No

Yes

XYZ1

System

Domain

XXX

Yes

Yes

Advanced

No

Yes

XYZ2

System

Domain

XXX

No

Yes

Legacy

No

Yes

 

 

Note: For a VBS script version of this HTA script that sends the information to an Excel spreadsheet see my previous post below:

 

HTA Script:

 

<Html>

<Head>

<Title>HTA Script</Title>

<Style>

Body {Background-Color: CornSilk}

</Style>

 

<HTA:Application

Caption = Yes

Border = Thick

ShowInTaskBar = No

MaximizeButton = Yes

MinimizeButton = Yes>

 

<Script Language = VBScript>

 

Sub WindowsLoad

 

strComputer = MachineName.Value

strSiteCode = SiteCode.Value

 

Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)

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

 

Window.Document.Title = "All Systems Collection For " & UCase(strComputer)

strHTML = "<table border='1' style='border-collapse: collapse' bordercolor='SaddleBrown' id='Table1' >"

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Name</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Resource Class</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Domain</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Site Code</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Client</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Assigned</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Type</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Obsolete</td>"

strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Active</td>"

strHTML = strHTML & "</tr>"

 

For Each objItem in colItems

 

Select Case objItem.IsClient

Case True objIsClient = "Yes"

Case False objIsClient = "No"

End Select

 

Select Case objItem.IsAssigned

Case True objIsAssigned = "Yes"

Case False objIsAssigned = "No"

End Select

 

Select Case objItem.ClientType

Case 0 objClientType = "Legacy"

Case 1 objClientType = "Advanced"

Case 3 objClientType = "Device"

End Select

 

Select Case objItem.ResourceType

Case 3 objResourceType = "User Group"

Case 4 objResourceType = "User"

Case 5 objResourceType = "System"

End Select

 

Select Case objItem.IsObsolete

Case True objIsObsolete = "Yes"

Case False objIsObsolete = "No"

End Select

 

Select Case objItem.IsActive

Case True objIsActive = "Yes"

Case False objIsActive = "No"

End Select

 

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%'>" & objItem.Name & "</td>"

strHTML = strHTML & "<td width='10%'>" & objResourceType  & "</td>"

strHTML = strHTML & "<td width='10%'>" & objItem.Domain & "</td>"

strHTML = strHTML & "<td width='10%'>" & objItem.SiteCode  & "</td>"

strHTML = strHTML & "<td width='10%'>" & objIsClient & "</td>"

strHTML = strHTML & "<td width='10%'>" & objIsAssigned  & "</td>"

strHTML = strHTML & "<td width='10%'>" & objClientType & "</td>"

strHTML = strHTML & "<td width='10%'>" & objIsObsolete  & "</td>"

strHTML = strHTML & "<td width='10%'>" & objIsActive & "</td>"

strHTML = strHTML & "</tr>"

 

Next

strHTML = strHTML & "</table>"

DataArea.InnerHTML = strHTML

 

End Sub

 

</Script><Body>

<p><h3 align = center><font color='Orange'>Please Visit myITforum.Com</font></h3>

<div></div>

SMS Server Name: <Input Type = "Text" Name = "MachineName">

SMS Site Code: <Input Type = "Text" Name = "SiteCode">

<Input Type = "Button" Value = "Run Script" Name = "Run_Button" onClick = "WindowsLoad"><P>

<Span Id = "DataArea"></Span></Body><Div Align = "Center">

<P><A Href="http://myitforum.com/cs2/blogs/dhite">Created For myITforum By Don Hite</A>

 

VBS Script To Emulate The SMS Consoles All Systems Collection Information And Send To Excel

http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/vbs-script-to-emulate-the-sms-consoles-all-systems-collection-information-and-send-to-excel.aspx

 

 

Published Wednesday, May 30, 2007 4:36 PM by dhite
Filed under:

Comments

# Scripting The SMS Administrator Consoles All Systems Collection

I was recently amending one of my VBS scripts that emulates the SMS administrator consoles &ldquo;All

Wednesday, May 30, 2007 5:40 PM by Don Hite