Hi,
I've bought a set of system restore disks for a Compaq desktop and done the
restore to a new hard drive. It installs WXP SP1 plus all the typical
crapware. After going through the initial bootup and setup stuff, I wanted
to get a list of installed software so I could methodically get rid of the
junk I didn't want. I downloaded the HTA at
http://www.microsoft.com/technet/scr.../cscsw044.mspx
and attempted to run it. All it does is display the HTA's source in an HTA
window. If I build a simple HTA, it displays only the <body> text just
fine. I've attached my two HTAs and appended them below.
I'm hoping someone can give me some insights to why this fresh new system
displays the tiny HTA correctly but displays the source file for the
ListInstalledSoftware HTA. In both cases I can see that mshta.exe is
started in windows task manager.
Since I will be deleting a lot of the junk currently installed, I don't
really want to upgrade IE to the latest version 6, to avoid confusion while
uninstalling the trial Office 2003 and the other junk.
Tiny HTA:
<html>
<head>
<title>Simple HTA</title>
<HTA:APPLICATION
ID="Simple"
APPLICATIONNAME="Simple HTA"
SCROLL="Yes"
ICON="ssi.ico"
SINGLEINSTANCE="no"
WINDOWSTATE="fixed"
</head>
<body>
This is a simple HTA (HTML Application)
</body>
</html>
ListInstalledSoftware HTA:
<!--
** Simple Software Inventory **
2006/05/21
Written by Jarno Mäki / IT Education Center Finland
This HTA contacts your computer thru network and queries
all the installed software that can be found from the
registry.
Note that this HTA doesn't work if target computer's
firewall is enabled.
Available from Microsoft's ScriptCenter
http://www.microsoft.com/technet/scr.../cscsw044.mspx
-->
<html>
<head>
<title>Simple Software Inventory</title>
<HTA:APPLICATION
ID="objSSI"
APPLICATIONNAME="Simple Software Inventory"
SCROLL="Yes"
ICON="ssi.ico"
SINGLEINSTANCE="no"
WINDOWSTATE="fixed"
</head>
<SCRIPT Language="VBScript">
Public strUser
Sub Window_onLoad
self.Focus()
self.ResizeTo 550,550
self.MoveTo 200,200
DataSpan.InnerHtml = "<em>Write the computer's name to the textbox you
want to audit.</em>"
End Sub
Sub GetSoftwareInventory()
On Error Resume Next
Const HKLM = &H80000002
strComputer = ComputerNameBox.Value
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
If Err.Number <> 0 Then Call ErrorCheck(Err.Number, Err.Description)
objReg.EnumKey HKLM, strKey, arrSubkeys
For Each strSubkey In arrSubkeys
strIsReal = 0
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
strIsReal = 1
strSoftat = strSoftat & "<b>" & strValue1 & "</b>" & " - "
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
strSoftat = strSoftat & "<font color=""#0000A0"">" & strValue2 &
"</font> - "
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
strSoftat = strSoftat & "<font color=""#008040"">" & intValue3 & "."
& intValue4 & "</font> - "
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
strSoftat = strSoftat & "<font color=""#808000"">" &
Round(intValue5/1024, 3) & " megabytes </font><br>"
Else
if strIsReal = 1 then strSoftat = strSoftat & "<br>"
End If
Next
DataSpan.InnerHtml = strSoftat
End Sub
Sub ErrorCheck(sErrorCode, sErrorDescription)
Select Case sErrorCode
Case 462
MsgBox "Target computer is not found!" & vbCrLf & VbCrLf _
& "Check that target computer is online and" & vbCrLf _
& "it's local firewall is disabled.",64,"Computer not found"
Err.Clear
Case Else
MsgBox "Error occurred." & vbCrLf & VbCrLf _
& "Error code is:" & sErrorCode & vbCrLf _
& "Error description is: " & sErrorDescription,64,"Mystical
error occurred"
Err.Clear
End Select
End Sub
</SCRIPT>
<body bgcolor="#D4D0C8" topmargin="0" leftmargin="0"
style="font-family: tahoma; font-size: 12; border-left: 1px solid
rgb(255,255,255); border-right: 1px solid rgb(128,128,128); border-top: 1px
solid rgb(255,255,255); border-bottom: 1px solid rgb(128,128,128)">
<div align="center"><center>
<table border="0" cellpadding="2" width="100%" style="font-family: tahoma;
font-size: 12">
<tr>
<td width="100%"><p style="font-family: Tahoma; font-size: 18;
font-weight: bold"><strong>Simple
Software Inventory<br>
</strong></p>
<p style="font-family: Tahoma; font-size: 18; font-weight:
normal"><small><small>Computername:</small></small></p>
<p> <input type="text" name="ComputerNameBox" size="24"
style="border: 1px solid"> <input
id="runbutton" class="button" Value="Audit" type="button"
name="GetSoftwareInventoryRun"
onClick="GetSoftwareInventory" style="font-family: Tahoma; font-size:
12; border: 1px solid"></p>
<div align="left">
<span id="DataSpan"></span>
</body>
</html>
Thanks for any help you can give me.