?
Solved

Object doesnt support this property or method

Posted on 2009-05-11
11
Medium Priority
?
643 Views
Last Modified: 2012-05-06
Hi great people.
Guys i have a hta that im working on but getting an annoying error.
The error im getting is:
Line 59
Char: 69
Error: Object doesnt support this property or method: 'Model.InnerHTML'
Code: 0

Any help greatly appreciated.
'========================= script.hta
 
 
<head>
<title>Enumerate System Information on Remote Computers</title>
<HTA:APPLICATION 
     APPLICATIONNAME="Enumerate System Information"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
<style type="text/css">
 
html {
font-family:arial;
font-size:smaller;
 
}
 
table {
border-collapse:collapse;
border:solid 1px black;
font-family:arial;
font-size:0.8em;
}
 
tr, td, th {
border-collapse:collapse;
border-style:solid;
}
 
td { border-width: 1px; }
 
.checks { background: #81BEF7; 
border-collapse:collapse;
border:solid 1px black;
cellpadding:1px;
padding:3px;
}
 
</style>
 
 
</head>
<script language="vbscript">
Sub Window_onLoad
	intWidth = 600
	intHeight = 480
	Me.ResizeTo intWidth, intHeight
	Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
End Sub
 
Sub GetInfo
run_button.disabled = True
ComputerListFile.disabled = True
Const ForReading = 1
Const ForWriting = 2
 
'--------------------------------------------------------
'1) Set the SPAN IDs to nothing:
'--------------------------------------------------------
SPacks.InnerHTML = "" : Archs.InnerHTML = "" :  OS.InnerHTML ="" :  Model.InnerHTML ="" :  Totals.InnerHTML = ""
 
'--------------------------------------------------------
'2) Initialize variables for each possible value returned:
'--------------------------------------------------------
iArch1 = 0 : iArch2 = 0 : iArch3 = 0 : iArch4 = 0 : iArch5 = 0 : iArchU = 0
iSpack1 = 0 : iSpack2 = 0 : iSpackU = 0 : iUnreach = 0
iOS1 = 0 : iOS2 = 0 : iOS3 = 0 : iOSU = 0
iModel1 = 0 : iModel2 = 0 : iModel3 = 0 : iModelU = 0
 
'--------------------------------------------------------
'3) Create an object for the Text File:
'--------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
'--------------------------------------------------------
'4) Determine what checkboxes have been checked:
'--------------------------------------------------------
 
If ServicePack.Checked=True or Architecture.Checked=True or OperatingSystem.Checked=True or Model.Checked=True then 
 
'--------------------------------------------------------
'5) If the text file read does have entries, then define a variable "List" to hold its contents:
'--------------------------------------------------------
 
        If ComputerListFile.Value <> "" Then
 
                If objFSO.FileExists(ComputerListFile.Value) = True Then
                        Set List = objFSO.OpenTextFile(ComputerListFile.Value, ForReading)
 
'--------------------------------------------------------
'6) Define a variable "strTotalHTML" to build a table:
'--------------------------------------------------------
             
  			strTotalHTML = "<table width='60%' border=1 bgcolor='white'>" &_
                        "<th style='background:c0c0c0'><b>System</b></th>"
 
'--------------------------------------------------------
'7) If a checkbox is checked, build a table for it:
'--------------------------------------------------------
 
'Service Pack:
                  If ServicePack.Checked=True then
				strSPHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Service Pack Audit Summary:</b>"
				SPacks.InnerHTML = strSPHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Service Pack</b>"
			End If
'Architecture:
                  If Architecture.Checked=True then
				strArchHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Architecture Audit Summary:</b>"
				Archs.InnerHTML = strArchHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Processor Type</b>"
			End If
'OperatingSystem:
                  If OperatingSystem.Checked=True then
				strOSHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Operating System Audit Summary:</b>"
				OS.InnerHTML = strOSHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Operating System</b>"
			End If
'Model:
                  If Model.Checked=True then
				strModelHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Model Audit Summary:</b>"
				Model.InnerHTML = strModelHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Model</b>"
			End If
 
			Totals.InnerHTML = strTotalHTML&"</tr>"
 
 
 
 
                        Do Until List.AtEndOfStream
				strComputer = List.ReadLine
				strTotalHTML = strTotalHTML &"<tr><td width='60%' border=1>" & strComputer &"</td>"
                                If Ping(strComputer) Then
					Set objWMIService = GetObject("winmgmts:" _
	                                        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
 
'--------------------------------------------------------
'8) If a checkbox is checked, then create a query for that selection:
'--------------------------------------------------------
 
'Service Pack:
                              If ServicePack.Checked = True then
	                                        Set colSpack = objWMIService.ExecQuery _
	                                        ("Select * from Win32_OperatingSystem")
 
	                                        For Each objSpack in colSpack
	                                                strSpack = objSpack.ServicePackMajorVersion
	                                        Next
 
	                                	If strSpack = "1" then
							iSpack1=iSpack1+1
							Elseif strSpack = "2" then
							iSpack2=iSpack2+1
							Else
							iSpackU=iSpackU+1
							End If
	                                        strTotalHTML = strTotalHTML &"<td bgcolor='green'><font color='white'>" &strSpack & "</font><br>"
 
					End If
 
'Architecture:
					If Architecture.Checked=True then
	                			Set colProcessors = objWMIService.ExecQuery _
	                			("Select * From Win32_Processor")
 
	                                        For Each objProcessor in colProcessors
							If objProcessor.Architecture = 0 Then
								strArch = "x86"
							Elseif objProcessor.Architecture = 1 Then
								strArch = "MIPS"
							Elseif objProcessor.Architecture = 2 Then
								strArch = "Alpha"
							Elseif objProcessor.Architecture = 3 Then
								strArch = "PowerPC"
							Elseif objProcessor.Architecture = 9 Then
								strArch = "x64"
							Else
								strArch = "Arch Unknown"
							End If
	                                        Next
 
						If strArch = "x86" then
							iArch1=iArch1+1
							Elseif strArch = "MIPS" then
							iArch2=iArch2+1
							Elseif strArch = "Alpha" then
							iArch3=iArch3+1
							Elseif strArch = "PowerPC" then
							iArch4=iArch4+1
							Elseif strArch = "x64" then
							iArch5=iArch5+1
							Else
							iArchU=iArchU+1
						End If
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strArch & "</font><br>"
 
					End If
 
'OperatingSystem:
					If OperatingSystem.Checked=True then
						Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
 
                					For Each objOS in colOS
                        				strOS = objOS.Caption
 							Next
 
	                                	If strOS = "Microsoft(R) Windows(R) Server 2003, Standard Edition" then
							iOS1=iOS1+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003, Enterprise Edition" then
							iOS2=iOS2+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003 Standard x64 Edition" then
							iOS3=iOS3+1
							Else
							iOSU=iOSU+1
							End If
 
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strOS & "</font><br>"
 
					End If
 
'Model:
					If Model.Checked=True then
						Set colModel = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
 
                					For Each objModel in colModel
                        				strModel = objModel.Model
 							Next
 
	                                	If strOS = "Microsoft(R) Windows(R) Server 2003, Standard Edition" then
							iOS1=iOS1+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003, Enterprise Edition" then
							iOS2=iOS2+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003 Standard x64 Edition" then
							iOS3=iOS3+1
							Else
							iOSU=iOSU+1
							End If
 
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strModel & "</font><br>"
 
					End If
 
 
                                Else
 
'--------------------------------------------------------
'9) Factor in unreachable machines:
'--------------------------------------------------------
 
					iUnreach = iUnreach + 1
					If ServicePack.Checked = True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If Architecture.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If OperatingSystem.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If Model.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
				End If
                        Loop
 
			If ServicePack.Checked = True then
				strSPHTML =  strSPHTML &"<tr><td width='80%' border=1>Service Pack 1"&_
	                 	"</td><td>" &iSpack1 & "<br>"&_
				"<tr><td width='80%' border=1>Service Pack 2"&_
	                 	"</td><td>" &iSpack2 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
	                 	"</td><td>" &iSpackU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
	                 	"</td><td>" &iUnreach & "<br></table>"
				SPacks.InnerHTML = strSPHTML
			End If
			If Architecture.Checked=True then
				strArchHTML =  strArchHTML &"<tr><td width='80%' border=1>x86"&_
				"</td><td>" &iArch1 & "<br>"&_
				"<tr><td width='80%' border=1>MIPS"&_
				"</td><td>" &iArch2 & "<br>"&_
				"<tr><td width='80%' border=1>Alpha"&_
				"</td><td>" &iArch3 & "<br>"&_
				"<tr><td width='80%' border=1>PowerPC"&_
				"</td><td>" &iArch4 & "<br>"&_
				"<tr><td width='80%' border=1>x64"&_
				"</td><td>" &iArch5 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iArchU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				Archs.InnerHTML = strArchHTML
			End If
			If OperatingSystem.Checked=True then
				strOSHTML =  strOSHTML &"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Standard Edition"&_
				"</td><td>" &iOS1 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Enterprise Edition"&_
				"</td><td>" &iOS2 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003 Standard x64 Edition"&_
				"</td><td>" &iOS3 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iOSU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				OS.InnerHTML = strOSHTML
			End If
			If Model.Checked=True then
				strModelHTML =  strModelHTML &"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Standard Edition"&_
				"</td><td>" &iOS1 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Enterprise Edition"&_
				"</td><td>" &iOS2 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003 Standard x64 Edition"&_
				"</td><td>" &iOS3 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iOSU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				Model.InnerHTML = strModelHTML
			End If
 
			Totals.InnerHTML = strTotalHTML
			List.Close      
                Else
                        MsgBox "File does not exist: " & ComputerListFile.Value
                End If
		run_button.disabled = False
		ComputerListFile.disabled = False
        Else
                MsgBox "Please specify a file name."
        End If
        run_button.disabled = False
        ComputerListFile.disabled = False
Else
	MsgBox "You must pick at least 1 option."
End If
run_button.disabled = False
ComputerListFile.disabled = False
End Sub
        
Function Ping(strComputer)
        Dim objShell, boolCode
        Set objShell = CreateObject("WScript.Shell")
        boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
        If boolCode = 0 Then
                Ping = True
        Else
                Ping = False
        End If
End Function
 
</script>
 
<body>
<input type="button" value="Run Script" name="run_button" onClick="GetInfo">
<input type="file" name="ComputerListFile" value="servers.txt"><br><br>
Inventory this information:<br><br>
<div class="checks" style="float:left;">
<input type="checkbox" name="ServicePack">Service Pack
<input type="checkbox" name="Architecture">Architecture
<input type="checkbox" name="OperatingSystem">Operating System
<input type="checkbox" name="Model">Model</div><br><br><br>
 
<!-- -------------------------------------------------------- -->
<!-- 7) Create the SPANs to hold the data: -->
<!-- -------------------------------------------------------- -->
 
<span id = "Spacks"></span><br>
<span id = "Archs"></span><br>
<span id = "OS"></span><br>
<span id = "Model"></span><br>
<span id = "Totals"></span><br><br>
</body>
</html>

Open in new window

0
Comment
Question by:Simon336697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 14

Accepted Solution

by:
rejoinder earned 1040 total points
ID: 24358574
I think there is an issue because you have names two things model in your html.
<input type="checkbox" name="Model">Model</div><br><br><br>
and
<span id = "Model"></span><br>
Even though on is an ID= and the other a name=, the code might be getting conflicted.  Try changing one of them to something else (ie. <input type="checkbox" name="chkbox_Model">Model</div><br><br><br>
).  Of course that means changing code above but hey you made it this far.
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 960 total points
ID: 24359596
Hi Simon, with HTA errors, the actual line with the error is always one more line down that it shows, so your error is on line 60, which is this line:
SPacks.InnerHTML = "" : Archs.InnerHTML = "" :  OS.InnerHTML ="" :  Model.InnerHTML ="" :  Totals.InnerHTML = ""

That line should be this (I don't like to put multiple statement on one line, it makes it difficult to debug):
SPacks.InnerHTML = ""
Archs.InnerHTML = ""
OS.InnerHTML = ""
Model.InnerHTML = ""
Totals.InnerHTML = ""

Regards,

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24359783
Actually, no, scratch that.....rejoinder is 100% right......ignore me....it was too early in the morning.....

Change the name of your span to
<span id = "ModelDetail"></span>

or something, then change all instances of
Model.InnerHTML
to
ModelDetail.InnerHTML

and you should be fine.

Regards,

Rob.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Simon336697
ID: 24360301
Hi Rob (hope you are well mate :>)), thanks Rob ill give this a try along with rejoinder.
You guys....I cant praise you enough :>)
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24360316
No problem.  No need to assign me any points....rejoinder was right in the first place :-)

Rob.
0
 
LVL 1

Author Comment

by:Simon336697
ID: 24360352
Hi guys,
Rob,
I changed the Model to ModelDetail.
Im getting closer, but Im now getting the following error:

Line: 230
Char: 29
Error: Object doesn't support this property or method: 'objModel.Model


Im using the following code :>)
<head>
<title>Enumerate System Information on Remote Computers</title>
<HTA:APPLICATION 
     APPLICATIONNAME="Enumerate System Information"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
<style type="text/css">
 
html {
font-family:arial;
font-size:smaller;
 
}
 
table {
border-collapse:collapse;
border:solid 1px black;
font-family:arial;
font-size:0.8em;
}
 
tr, td, th {
border-collapse:collapse;
border-style:solid;
}
 
td { border-width: 1px; }
 
.checks { background: #81BEF7; 
border-collapse:collapse;
border:solid 1px black;
cellpadding:1px;
padding:3px;
}
 
</style>
 
 
</head>
<script language="vbscript">
Sub Window_onLoad
	intWidth = 600
	intHeight = 480
	Me.ResizeTo intWidth, intHeight
	Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
End Sub
 
Sub GetInfo
run_button.disabled = True
ComputerListFile.disabled = True
Const ForReading = 1
Const ForWriting = 2
 
'--------------------------------------------------------
'1) Set the SPAN IDs to nothing:
'--------------------------------------------------------
SPacks.InnerHTML = "" : Archs.InnerHTML = "" :  OS.InnerHTML ="" :  ModelDetail.InnerHTML ="" : Totals.InnerHTML = ""
 
'--------------------------------------------------------
'2) Initialize variables for each possible value returned:
'--------------------------------------------------------
iArch1 = 0 : iArch2 = 0 : iArch3 = 0 : iArch4 = 0 : iArch5 = 0 : iArchU = 0
iSpack1 = 0 : iSpack2 = 0 : iSpackU = 0 : iUnreach = 0
iOS1 = 0 : iOS2 = 0 : iOS3 = 0 : iOSU = 0
iModel1 = 0 : iModel2 = 0 : iModel3 = 0 : iModelU = 0
 
'--------------------------------------------------------
'3) Create an object for the Text File:
'--------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
'--------------------------------------------------------
'4) Determine what checkboxes have been checked:
'--------------------------------------------------------
 
If ServicePack.Checked=True or Architecture.Checked=True or OperatingSystem.Checked=True or Model.Checked=True then 
 
'--------------------------------------------------------
'5) If the text file read does have entries, then define a variable "List" to hold its contents:
'--------------------------------------------------------
 
        If ComputerListFile.Value <> "" Then
 
                If objFSO.FileExists(ComputerListFile.Value) = True Then
                        Set List = objFSO.OpenTextFile(ComputerListFile.Value, ForReading)
 
'--------------------------------------------------------
'6) Define a variable "strTotalHTML" to build a table:
'--------------------------------------------------------
             
  			strTotalHTML = "<table width='60%' border=1 bgcolor='white'>" &_
                        "<th style='background:c0c0c0'><b>System</b></th>"
 
'--------------------------------------------------------
'7) If a checkbox is checked, build a table for it:
'--------------------------------------------------------
 
'Service Pack:
                  If ServicePack.Checked=True then
				strSPHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Service Pack Audit Summary:</b>"
				SPacks.InnerHTML = strSPHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Service Pack</b>"
			End If
'Architecture:
                  If Architecture.Checked=True then
				strArchHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Architecture Audit Summary:</b>"
				Archs.InnerHTML = strArchHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Processor Type</b>"
			End If
'OperatingSystem:
                  If OperatingSystem.Checked=True then
				strOSHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Operating System Audit Summary:</b>"
				OS.InnerHTML = strOSHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Operating System</b>"
			End If
'Model:
                  If Model.Checked=True then
				strModelHTML = "<table width='60%' border=1>" &_
				"<th colspan='2' style='background:c0c0c0'><b>Model Audit Summary:</b>"
				ModelDetail.InnerHTML = strModelHTML
				strTotalHTML = strTotalHTML&"<th style='background:c0c0c0'><b>Model</b>"
			End If
 
			Totals.InnerHTML = strTotalHTML&"</tr>"
 
                        Do Until List.AtEndOfStream
				strComputer = List.ReadLine
				strTotalHTML = strTotalHTML &"<tr><td width='60%' border=1>" & strComputer &"</td>"
                                If Ping(strComputer) Then
					Set objWMIService = GetObject("winmgmts:" _
	                                        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
 
'--------------------------------------------------------
'8) If a checkbox is checked, then create a query for that selection:
'--------------------------------------------------------
 
'Service Pack:
                              If ServicePack.Checked = True then
	                                        Set colSpack = objWMIService.ExecQuery _
	                                        ("Select * from Win32_OperatingSystem")
 
	                                        For Each objSpack in colSpack
	                                                strSpack = objSpack.ServicePackMajorVersion
	                                        Next
 
	                                	If strSpack = "1" then
							iSpack1=iSpack1+1
							Elseif strSpack = "2" then
							iSpack2=iSpack2+1
							Else
							iSpackU=iSpackU+1
							End If
	                                        strTotalHTML = strTotalHTML &"<td bgcolor='green'><font color='white'>" &strSpack & "</font><br>"
 
					End If
 
'Architecture:
					If Architecture.Checked=True then
	                			Set colProcessors = objWMIService.ExecQuery _
	                			("Select * From Win32_Processor")
 
	                                        For Each objProcessor in colProcessors
							If objProcessor.Architecture = 0 Then
								strArch = "x86"
							Elseif objProcessor.Architecture = 1 Then
								strArch = "MIPS"
							Elseif objProcessor.Architecture = 2 Then
								strArch = "Alpha"
							Elseif objProcessor.Architecture = 3 Then
								strArch = "PowerPC"
							Elseif objProcessor.Architecture = 9 Then
								strArch = "x64"
							Else
								strArch = "Arch Unknown"
							End If
	                                        Next
 
						If strArch = "x86" then
							iArch1=iArch1+1
							Elseif strArch = "MIPS" then
							iArch2=iArch2+1
							Elseif strArch = "Alpha" then
							iArch3=iArch3+1
							Elseif strArch = "PowerPC" then
							iArch4=iArch4+1
							Elseif strArch = "x64" then
							iArch5=iArch5+1
							Else
							iArchU=iArchU+1
						End If
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strArch & "</font><br>"
 
					End If
 
'OperatingSystem:
					If OperatingSystem.Checked=True then
						Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
 
                					For Each objOS in colOS
                        				strOS = objOS.Caption
 							Next
 
	                                	If strOS = "Microsoft(R) Windows(R) Server 2003, Standard Edition" then
							iOS1=iOS1+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003, Enterprise Edition" then
							iOS2=iOS2+1
							Elseif strOS = "Microsoft(R) Windows(R) Server 2003 Standard x64 Edition" then
							iOS3=iOS3+1
							Else
							iOSU=iOSU+1
							End If
 
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strOS & "</font><br>"
 
					End If
 
'Model:
					If Model.Checked=True then
						Set colModels = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
 
                					For Each objModel in colModels
                        				strModel = objModel.Model
 							Next
 
	                                	If strModel = "Microsoft(R) Windows(R) Server 2003, Standard Edition" then
							iModel1=iModel1+1
							Elseif strModel = "Microsoft(R) Windows(R) Server 2003, Enterprise Edition" then
							iModel2=iModel2+1
							Elseif strModel = "Microsoft(R) Windows(R) Server 2003 Standard x64 Edition" then
							iModel3=iModel3+1
							Else
							iModelU=iModelU+1
							End If
 
 
 						strTotalHTML =  strTotalHTML &"<td bgcolor='green'><font color='white'>" &strModel & "</font><br>"
 
					End If
 
 
                                Else
 
'--------------------------------------------------------
'9) Factor in unreachable machines:
'--------------------------------------------------------
 
					iUnreach = iUnreach + 1
					If ServicePack.Checked = True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If Architecture.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If OperatingSystem.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
					If Model.Checked=True then
						strTotalHTML = strTotalHTML &"<td bgcolor='red'><font color='white'>Unreachable</font></td>"
					End If
				End If
                        Loop
 
			If ServicePack.Checked = True then
				strSPHTML =  strSPHTML &"<tr><td width='80%' border=1>Service Pack 1"&_
	                 	"</td><td>" &iSpack1 & "<br>"&_
				"<tr><td width='80%' border=1>Service Pack 2"&_
	                 	"</td><td>" &iSpack2 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
	                 	"</td><td>" &iSpackU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
	                 	"</td><td>" &iUnreach & "<br></table>"
				SPacks.InnerHTML = strSPHTML
			End If
			If Architecture.Checked=True then
				strArchHTML =  strArchHTML &"<tr><td width='80%' border=1>x86"&_
				"</td><td>" &iArch1 & "<br>"&_
				"<tr><td width='80%' border=1>MIPS"&_
				"</td><td>" &iArch2 & "<br>"&_
				"<tr><td width='80%' border=1>Alpha"&_
				"</td><td>" &iArch3 & "<br>"&_
				"<tr><td width='80%' border=1>PowerPC"&_
				"</td><td>" &iArch4 & "<br>"&_
				"<tr><td width='80%' border=1>x64"&_
				"</td><td>" &iArch5 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iArchU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				Archs.InnerHTML = strArchHTML
			End If
			If OperatingSystem.Checked=True then
				strOSHTML =  strOSHTML &"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Standard Edition"&_
				"</td><td>" &iOS1 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Enterprise Edition"&_
				"</td><td>" &iOS2 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003 Standard x64 Edition"&_
				"</td><td>" &iOS3 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iOSU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				OS.InnerHTML = strOSHTML
			End If
			If Model.Checked=True then
				strModelHTML =  strModelHTML &"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Standard Edition"&_
				"</td><td>" &iOS1 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003, Enterprise Edition"&_
				"</td><td>" &iOS2 & "<br>"&_
				"<tr><td width='80%' border=1>Microsoft(R) Windows(R) Server 2003 Standard x64 Edition"&_
				"</td><td>" &iOS3 & "<br>"&_
				"<tr><td width='80%' border=1>Unknown"&_
				"</td><td>" &iOSU & "<br>"&_
				"<tr><td width='80%' border=1>Unreachable"&_
				"</td><td>" &iUnreach & "<br></table>"
				ModelDetail.InnerHTML = strModelHTML
			End If
 
			Totals.InnerHTML = strTotalHTML
			List.Close      
                Else
                        MsgBox "File does not exist: " & ComputerListFile.Value
                End If
		run_button.disabled = False
		ComputerListFile.disabled = False
        Else
                MsgBox "Please specify a file name."
        End If
        run_button.disabled = False
        ComputerListFile.disabled = False
Else
	MsgBox "You must pick at least 1 option."
End If
run_button.disabled = False
ComputerListFile.disabled = False
End Sub
        
Function Ping(strComputer)
        Dim objShell, boolCode
        Set objShell = CreateObject("WScript.Shell")
        boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
        If boolCode = 0 Then
                Ping = True
        Else
                Ping = False
        End If
End Function
 
</script>
 
<body>
<input type="button" value="Run Script" name="run_button" onClick="GetInfo">
<input type="file" name="ComputerListFile" value="servers.txt"><br><br>
Inventory this information:<br><br>
<div class="checks" style="float:left;">
<input type="checkbox" name="ServicePack">Service Pack
<input type="checkbox" name="Architecture">Architecture
<input type="checkbox" name="OperatingSystem">Operating System
<input type="checkbox" name="Model">Model</div><br><br><br>
 
<!-- -------------------------------------------------------- -->
<!-- 7) Create the SPANs to hold the data: -->
<!-- -------------------------------------------------------- -->
 
<span id = "Spacks"></span><br>
<span id = "Archs"></span><br>
<span id = "OS"></span><br>
<span id = "ModelDetail"></span><br>
<span id = "Totals"></span><br><br>
</body>
</html>
 

Open in new window

0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24360387
Hi, the Model attribute is not available from Win32_OperatingSystem, so I believe the property you're looking for is Caption.

Try changing this:
                  For Each objModel in colModels
                        strModel = objModel.Model
                  Next

to this
                  For Each objModel in colModels
                        strModel = objModel.Caption
                  Next


Regards,

Rob.
0
 
LVL 1

Author Comment

by:Simon336697
ID: 24360496
Rob youre the best mate.
I was using
Win32_OperatingSystem
instead of
Win32_ComputerSystem
with the Model

Thanks so much Rob and rejoinder.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24360726
Oh, cool.  So it's all good then?  Glad to help.

Regards,

Rob.
0
 
LVL 14

Expert Comment

by:rejoinder
ID: 24361279
You are very welcome.
0
 
LVL 1

Author Comment

by:Simon336697
ID: 24371829
Rob and rejoinder, thank you so much guys :>)
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question