HTA Script To List Roles For A Specified Site Server

 

This HTA script will take a site server name and site code and list all of the available site system roles for the server and send the results to the active window.

 

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

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

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Site Server Roles</td>"

strHTML = strHTML & "</tr>"

 

strComputer = SiteServer.Value

strSiteCode = SiteCode.Value

 

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

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

For Each objItem in colItems

 

strHTML = strHTML & "<tr>"

Window.Document.Title = "Site Server Roles For " & UCase(SiteServer.Value) & " (" & UCase(SiteCode.Value) & ")"

strHTML = strHTML & "<td width='1%'>" & objItem.RoleName & "</td>"

Next

strHTML = strHTML & "</tr>"

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>

Site Server: <Input Type = "Text" Name = "SiteServer">

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>

 

 

Published Sunday, October 26, 2008 2:32 PM by dhite
Filed under:

Comments

No Comments