Asset Intelligence License Ledger HTA Script

 

Provided here is an HTA Script to function as an Asset Intelligence License Ledger.

 

 

Count

Family Name

Product Name

Version

License Type

212

Office Enterprise

Office Enterprise 2007

2007

Microsoft Volume License

174

Office Professional

Office Professional Plus 2007

Plus 2007

Microsoft Volume License

11

SQL Server - Standard

SQL Server - Standard 2005

2005

Single User License

3

Windows Server - Standard

Windows Server - Standard 2008

2008

Single User License

 

 

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>

Window.Document.Title = "Asset Intelligence License Ledger"

Sub WindowsLoad

strSqlServer = SqlServer.value

strDatabase = Database.value

 

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

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<br>"

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

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

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

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

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>License Type</td>"

strHTML = strHTML & "</tr>"

 

Const adOpenStatic = 3

Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")

Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open "Provider=SQLOLEDB;Data Source =" & strSqlServer & ";" & _

"Trusted_Connection=Yes;Initial Catalog =SMS_" & strDatabase

objRecordSet.Open _

"Select Count(GIS.ResourceID) Counts, " & _

"LMP.MLSFamilyName, LMP.MLSProductName, " & _

"LMP.VersionCode, LMP.LicenseTypeName " & _

"From v_Gs_Installed_Software_MS GIS " & _

"Join v_Lu_MSProd LMP On GIS.MPC0 = LMP.MPC " & _

"Where LMP.MLSFamilyName <> 'Null' " & _

"Group By LMP.MLSFamilyName, LMP.MLSProductName, LMP.VersionCode, " & _

"LMP.ProductDistTypeName, LMP.LicenseTypeName ",objConnection, adOpenStatic, adLockOptimistic

 

On Error Resume Next

objRecordSet.MoveFirst

Do Until objRecordset.EOF

strHTML = strHTML & "<tr>"

Window.Document.Title =  "License Ledger"

strHTML = strHTML & "<td width='1%'>" & objRecordset.Fields.Item("Counts") & "</td>"

strHTML = strHTML & "<td width='1%'>" & objRecordset.Fields.Item("MLSFamilyName") & "</td>"

strHTML = strHTML & "<td width='1%'>" & objRecordset.Fields.Item("MLSProductName") & "</td>"

strHTML = strHTML & "<td width='1%'>" & objRecordset.Fields.Item("VersionCode") & "</td>"

strHTML = strHTML & "<td width='1%'>" & objRecordset.Fields.Item("LicenseTypeName") & "</td>"

objRecordset.MoveNext

Loop

 

objRecordSet.Close

objConnection.Close

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 Name: <Input Type = "Text" Name = "SqlServer">

Site Code: <Input Type = "Text" Name = "Database">

<input id=DisplayButton class="button" type="button" value="Run Script" name="DisplayItems_button" onClick="WindowsLoad">

</body></html>

<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, November 16, 2008 7:43 PM by dhite
Filed under:

Comments

No Comments