Add And Remove Programs For A Specified Machine

 

This HTA script Will take a machine name specified in the input box and write the Win32Reg_AddRemovePrograms information for the machine 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

 

strComputer = MachineName.Value

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

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

 

Window.Document.Title = "Add And Remove Programs For " & UCase(strComputer)

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

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'DarkGreen'><b>Display Name</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'DarkGreen'><b>Publisher</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'DarkGreen'><b>Version</td>"

strHTML = strHTML & "</tr>"

 

For Each objItem in colItems

strHTML = strHTML & "<tr>"

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

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

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

strHTML = strHTML & "</tr>"

 

Next

strHTML = strHTML & "</table>"

DataArea.InnerHTML = strHTML

 

End Sub

 

</Script><Body>

Enter Machine Name: <Input Type = "Text" Name = "MachineName">

<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, April 29, 2007 11:40 AM by dhite
Filed under:

Comments

No Comments