<html>
<head>
<title>Hardware Inventory</title>

<HTA:APPLICATION 
     ID="HardwInv"
     VERSION="5.49"
     APPLICATIONNAME="Basic Hardware Inventory"
     SCROLL="auto"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="maximize"
>

<style type="text/css">
a { color: red; }
.Button { width: 6em; margin: 3px 1em 3px 1em; }
</style>

</head>

<script language="VBScript">
Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ             = 1


' Variable to tell if the program should check for updates at startup
' If True then a check for updates is performed at startup
' If False then the check is skipped
' Command line switch /NOUPDCHK sets variable to False
Dim gvbUpdateCheck

' Variable to control the display of monitor size
' If False then size is displayed as diagonal in inches
' If True then size is displayed as width x height in centimetres
' Command line switch /CM sets variable to True
Dim gvbDisplaySizeInCm

' Variable to limit the inventory to CPU, memory and HDDs only
' If False then only CPU, memory and HDDs are selected
' If True then all components are selected
' Command line switch /BASIC sets variable to False
Dim gvbFullInventory

' Variable to include USB drives
' If False then USB drives are excluded
' If True then USB drives are included
' Command line switch /USBSTOR sets variable to True
Dim gvbUSBSTOR

' Variable to tell the program to use DXDIAG.EXE to read monitor data
' If False then WMI is used (faster, but not as reliable)
' If True then DXDIAG.EXE is used (slow, and only on local computer)
' Command line switch /DXDIAG sets variable to True unless /COMPUTER is specified
Dim gvbUseDxDiag

' Variables for a tweak for Internet Explorer 7 and older versions
' If gvbIE7 is False then multiple HDDs, CDROMs etc. are revealed using style.display = "table-row"
' If gvbIE7 is True then multiple HDDs, CDROMs etc. are revealed using style.display = "inline"
Dim gvbIE7, gvsTableRowStyle

' Variable for testing purposes
' If True then the values in some fields will be replaced by fixed numbers or strings
' If False then all results will be displayed unaltered
' Command line switch /TEST sets variable to True
Dim gvbTest

' Variable to hold the command line, converted to upper case
Dim gvsCmdLine

' Variable containing the path of the HTA's parent folder
Dim gvsHTAPath

' Variable containing the CSV export file name
' If * then a dialog window will prompt for a file name
' If empty, the default is "Hardware.csv", located in the current working directory
' Use command line switch /SAVE:filename to set the file name/path
Dim gvsCSVTxtFile

' Variable containing the XML export file name for DxDiag
' The default is "Hardware.xml", located in the current working directory
' Use command line switch /XML:filename to set the file name/path
Dim gvsXML

' Variable to tell the program wether to keep and reuse the DxDiag XML file or not
' If True then an existing XML file will be reused, and the XML file will NOT be deleted upon termination of the program
' If False then a new XML file will be ctreated, and the XML file will be deleted upon termination of the program
' Command line switch /KeepXML sets variable to True
Dim gvbKeepXML

' Global File System Object
Dim gvoFSO

' Other global variables
Dim gvaCDROM( ), gvaHDC( ), gvaHDD( ), gvaHost( ), gvaRawEDID, gvaVideo( )
Dim clrBgErr, clrTxtErr
Dim gvcBanks, gvcCDROM, gvcCPU, gvcHDD, gvcMemory, gvcMonitor, gvcNIC, gvcVideo
Dim gviCDROM, gviHDC, gviHDD, gviHost, gviNumOS, gviReqHeight, gviReqWidth, gviMemSize, gviMemSpeed
Dim gvoIECredits, gvoIEHelp, gvoIEPrint, gvoWMIService
Dim gvsComputer, gvsCSVTxt, gvsDetails, gvsHeader, gvsMonitorModel, gvsMonitorSerial



Sub Basic( )
	gvbFullInventory          = Not gvbFullInventory
	CheckboxBIOS.Checked      = gvbFullInventory
	CheckboxCDROM.Checked     = gvbFullInventory
	CheckboxCPU.Checked       = True
	CheckboxHDD.Checked       = True
	CheckboxMainBoard.Checked = gvbFullInventory
	CheckboxMemory.Checked    = True
	CheckboxMonitor.Checked   = gvbFullInventory
	CheckboxNIC.Checked       = gvbFullInventory
	CheckboxPorts.Checked     = gvbFullInventory
	CheckboxVideo.Checked     = gvbFullInventory
	CheckboxSound.Checked     = gvbFullInventory
	If gvbFullInventory Then
		ButtonBasic.Value = "Basic"
	Else
		ButtonBasic.Value = "Full"
	End If
End Sub


Function Chassis( gvsComputer )
' VBScript to interrogate a machine's chassis type.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.3 - November 2005
	Dim colChassis, objChassis, objItem

	Chassis = "Unknown"

	Set colChassis = gvoWMIService.ExecQuery( "Select ChassisTypes from Win32_SystemEnclosure" )
	For Each objChassis in colChassis
		For Each objItem in objChassis.ChassisTypes
			Select Case objItem
				Case  1 Chassis = "Maybe Virtual Machine"
				Case  3 Chassis = "Desktop"
				Case  4 Chassis = "Thin Desktop"
				Case  5 Chassis = "Pizza Box"
				Case  6 Chassis = "Mini Tower"
				Case  7 Chassis = "Full Tower"
				Case  8 Chassis = "Portable"
				Case  9 Chassis = "Laptop"
				Case 10 Chassis = "Notebook"
				Case 11 Chassis = "Hand Held"
				Case 12 Chassis = "Docking Station"
				Case 13 Chassis = "All in One"
				Case 14 Chassis = "Sub Notebook"
				Case 15 Chassis = "Space-Saving"
				Case 16 Chassis = "Lunch Box"
				Case 17 Chassis = "Main System Chassis"
				Case 18 Chassis = "Lunch Box"
				Case 19 Chassis = "SubChassis"
				Case 20 Chassis = "Bus Expansion Chassis"
				Case 21 Chassis = "Peripheral Chassis"
				Case 22 Chassis = "Storage Chassis"
				Case 23 Chassis = "Rack Mount Unit"
				Case 24 Chassis = "Sealed-Case PC"
			End Select
		Next
	Next
End Function

Sub CheckForEnterKey()
	If Window.Event.Keycode = 13 Then Inventory
End Sub


Sub CheckUpdate( )
	Dim lenLatestVer, strCurrentVer, strLatestVer

	If gvbUpdateCheck Then
		' Change cursor to hourglass while checking for update
		Document.Body.Style.Cursor = "wait"
	
		strLatestVer = TextFromHTML( "http://www.robvanderwoude.com/updates/hardware.txt" )
		lenLatestVer = Len( strLatestVer )
		If lenLatestVer = 4 Then
			strCurrentVer = Split( HardwInv.Version )(0)
			If strLatestVer < strCurrentVer Then
				UpdateBlock.style.display    = "block"
				UpdateBlock.style.border     = "2px solid red"
				UpdateNotification.InnerHTML = "You seem to be using a pre-release version (" & HardwInv.Version & ") of Hardware.hta. The latest stable release is " & strLatestVer & "."
			End If
			If strLatestVer > strCurrentVer Then
				UpdateBlock.style.display    = "block"
				UpdateBlock.style.border     = "2px solid red"
				UpdateNotification.InnerHTML = "You are using version " & HardwInv.Version & " of Hardware.hta. The latest stable release is " & strLatestVer & "."
			End If
			If strLatestVer = strCurrentVer Then
				UpdateBlock.style.display    = "none"
			End If
		Else
			MsgBox "Unable to check for updates." & vbCrLf & vbCrLf & "To ""manually"" check for a new version, navigate to" & vbCrLf & vbCrLf & "http://www.robvanderwoude.com/hardware.php", vbOKOnly, "Update Check"
		End If
	
		' Change cursor back to default
		Document.Body.Style.Cursor = "default"
	End If
End Sub


Sub Configure( )
	Dim blnReload, objFile, strBaseName, wshShell
	blnReload = False
	Set wshShell = CreateObject( "WScript.Shell" )
	strBaseName = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 )
	wshShell.Run "notepad.exe " & strBaseName & ".cfg", 5, True
	If gvoFSO.FileExists( strBaseName & ".cfg" ) Then
		Set objFile = gvoFSO.GetFile( strBaseName & ".cfg" )
		If objFile.Size > 0 Then
			blnReload = True
		Else
			objFile.Delete
			MsgBox "WARNING: 0 byte configuration file has been deleted.", vbOKOnly, "Configuration File Error"
		End If
		Set objFile = Nothing
	End If
	If blnReload Then Self.location.reload True
End Sub


Sub CopyToClipboard
	On Error Resume Next
	Document.ParentWindow.ClipboardData.SetData "text", gvsHeader & vbCrLf & gvsCSVTxt & vbCrLf
	If Err Then
		MsgBox "An error occurred while trying to copy data to the clipboard:" & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Clipboard Error"
	End If
	On Error Goto 0
End Sub


Sub CheckWindowSize( )
	If InStr( gvsCmdLine, "/SIZE:" ) > 0 Then WxH InStr( gvsCmdLine, "/SIZE:" ) + 5
End Sub


Sub CreateIECredits( )
	On Error Resume Next
	gvoIECredits.Quit
	Set gvoIECredits = Nothing
	On Error Goto 0
	Set gvoIECredits = CreateObject( "InternetExplorer.Application" )
	While gvoIECredits.Busy
		Sleep 1
	Wend
	gvoIECredits.Navigate "about:blank"
	gvoIECredits.AddressBar  = 1
	gvoIECredits.MenuBar     = 1
	gvoIECredits.StatusBar   = 1
	gvoIECredits.ToolBar     = 1
	gvoIECredits.Top         = 0
	gvoIECredits.Left        = 0
	gvoIECredits.Width       = document.body.clientWidth
	gvoIECredits.Height      = document.body.clientHeight
	gvoIECredits.TheaterMode = 0
	gvoIECredits.Visible     = 1
End Sub


Sub CreateIEHelp( )
	On Error Resume Next
	gvoIEHelp.Quit
	Set gvoIEHelp = Nothing
	On Error Goto 0
	Set gvoIEHelp = CreateObject( "InternetExplorer.Application" )
	While gvoIEHelp.Busy
		Sleep 1
	Wend
	gvoIEHelp.Navigate "about:blank"
	gvoIEHelp.AddressBar  = 1
	gvoIEHelp.MenuBar     = 1
	gvoIEHelp.StatusBar   = 1
	gvoIEHelp.ToolBar     = 1
	gvoIEHelp.Top         = 0
	gvoIEHelp.Left        = 0
	gvoIEHelp.Width       = document.body.clientWidth
	gvoIEHelp.Height      = document.body.clientHeight
	gvoIEHelp.TheaterMode = 0
	gvoIEHelp.Visible     = 1
End Sub


Sub CreateIEPrint( )
	On Error Resume Next
	gvoIEPrint.Quit
	Set gvoIEPrint = Nothing
	On Error Goto 0
	Set gvoIEPrint = CreateObject( "InternetExplorer.Application" )
	While gvoIEPrint.Busy
		Sleep 1
	Wend
	gvoIEPrint.Navigate "about:blank"
	gvoIEPrint.Visible = 0
End Sub


Function CreateLine( strProperty )
	' This subroutine will split up a string into separate words:
	' "SCSILogicalUnit" will be converted to "SCSI Logical Unit"
	Dim chrA, chrB, chrC
	Dim i, j, k
	Dim strCaps, strLowc, strPad, strPropDescr

	strPropDescr = strProperty
	strCaps      = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	strPad       = String( 30, " " )
	strLowc      = LCase( strCaps )

	' Default value, in case something gîs wrong
	CreateLine   = Left( strProperty & strPad, 31 ) & ": "

	On Error Resume Next

	i = 0
	Do
		i = i + 1
		j = i + 1
		If j >= Len( strPropDescr ) Then Exit Do
		chrA = Mid( strPropDescr, i, 1 )
		chrB = Mid( strPropDescr, j, 1 )
		If InStr( strLowc, chrA ) > 0 And InStr( strCaps, chrB ) > 0 Then
			strPropDescr = Left( strPropDescr, i ) & " " & Mid( strPropDescr, j )
			i = i + 2
			j = i + 1
		End If
	Loop

	If Len( strPropDescr ) > 2 Then
		i = 0
		Do
			i = i + 1
			j = i + 1
			k = i + 2
			If k >= Len( strPropDescr ) Then Exit Do
			chrA = Mid( strPropDescr, i, 1 )
			chrB = Mid( strPropDescr, j, 1 )
			chrC = Mid( strPropDescr, k, 1 )
			If InStr( strCaps, chrA ) > 0 And InStr( strCaps, chrB ) > 0 And InStr( strLowc, chrC ) > 0 Then
				strPropDescr = Left( strPropDescr, i ) & " " & Mid( strPropDescr, j )
				i = i + 3
				j = i + 1
				k = i + 2
			End If
		Loop
	End If

	CreateLine = Left( strPropDescr & strPad, 31 ) & ": "

	On Error Goto 0
End Function


Sub Credits( )
	Dim objDoc, strHTML

	On Error Resume Next
	CreateIECredits
	While gvoIECredits.Busy
		Sleep 1
	Wend
	gvoIECredits.Navigate "about:blank"
	On Error Goto 0

	gvoIECredits.AddressBar     = False
	gvoIECredits.MenuBar        = False
	gvoIECredits.Resizable      = False
	gvoIECredits.StatusBar      = False
	gvoIECredits.ToolBar        = False
	gvoIECredits.Width          = Min( gviReqWidth,  900 )
	gvoIECredits.Height         = Min( gviReqHeight, 600 )
	gvoIECredits.Left           = Int( ( window.screen.width  - gvoIECredits.Width  ) / 2 )
	gvoIECredits.Top            = Int( ( window.screen.height - gvoIECredits.Height ) / 2 )
	Set objDoc                  = gvoIECredits.Document.Body
	strHTML                     = "<h1 style=""text-align: center;"">Basic Hardware Inventory</h1>" & vbCrLf _
	                            & vbCrLf _
	                            & "<h2 style=""text-align: center;"">Version " & HardwInv.Version & "</h1>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p style=""text-align: center;"">&copy; 2005 - 2012, Rob van der Woude<br>" & vbCrLf _
	                            & "<a href=""http://www.robvanderwoude.com/hardware.php"">" _
	                            & "www.robvanderwoude.com/hardware.php</a></p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>&nbsp;</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>Created using the Microsoft Scripting Guys' " _
	                            & "<a href=""http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx"">" _
	                            & "Scriptomatic 2.0</a> and " _
	                            & "<a href=""http://www.microsoft.com/downloads/details.aspx?FamilyId=231D8143-F21B-4707-B583-µ7B9152E6D9&displaylang=en"">" _
	                            & "HTA Helpomatic</a> tools, and Adersoft's " _
	                            & "<a href=""http://www.htµdit.com/"">HTµdit</a>.</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>Chassis subroutine based on a script by " _
	                            & "<a href=""http://www.computerperformance.co.uk/ezine/ezine94.htm"">" _
	                            & "Guy Thomas</a>.</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>Monitor EDID data parsing based on a script by Michµl Baird (no longer available online).</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>HandleClass function based on the Microsoft TechNet ScriptCenter article " _
	                            & "<a href=""http://www.microsoft.com/technet/scriptcenter/resources/guiguy/default.mspx"">" _
	                            & "Scripting Eye for the GUI Guy</a>.</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>Code tested and optimized for speed and compatibility by Steve Robertson.</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>Idea to use, and testing of, DxDiag for video properties by Gary Johnson.</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p>&nbsp;</p>" & vbCrLf _
	                            & vbCrLf _
	                            & "<p style=""text-align: center; margin: 0 auto 0 auto;""><input type=""button"" onclick=""window.close()"" value="" OK "" style=""width: 200px;""></p>"
	objDoc.InnerHTML            = strHTML
	objDoc.style.FontFamily     = "Arial"
	gvoIECredits.Document.Title = "Credits for Basic Hardware Inventory (Version " & HardwInv.Version & ") © Rob van der Woude 2005 - 2012"
	gvoIECredits.Visible        = True
End Sub


Sub DetailsBIOS( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_BIOS", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/BIOS" )
	End If
	DetailsWindow "BIOS", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsCDROM( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_CDROMDrive",           "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_IDEController",        "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SCSIController",       "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_IDEControllerDevice",  "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SCSIControllerDevice", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/LogicalDisks/LogicalDisk[HardDriveIndex = 0 and FileSystem <= """"]" )
	End If
	DetailsWindow "CD/DVD-ROM Drives and Controllers", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsCPU( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_Processor", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/Processor" )
	End If
	DetailsWindow "CPU", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsHDD( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_DiskDrive",            "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_IDEController",        "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SCSIController",       "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_IDEControllerDevice",  "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SCSIControllerDevice", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/LogicalDisks/LogicalDisk[Model > """" and FileSystem > """"]" )
	End If
	DetailsWindow "Disk Drives and Controllers", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsMainBoard( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_BaseBoard",       "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SystemEnclosure", "root/CIMV2" )
	DetailsWindow "Main Board &amp; Chassis", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsMemory( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_PhysicalMemoryArray", "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_PhysicalMemory",      "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/Memory" )
	End If
	DetailsWindow "Memory", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsMonitor( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_DesktopMonitor",         "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "WmiMonitorBasicDisplayParams", "root/WMI"   ) & vbCrLf & vbCrLf _
	           & HandleClass( "WmiMonitorID",                 "root/WMI"   )
	DetailsWindow "Display Adapter", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsNIC( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_NetworkAdapter",      "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "MSNdis_LinkSpeed",          "root/WMI"   ) & vbCrLf & vbCrLf _
	           & HandleClass( "MSNdis_PhysicalMediumType", "root/WMI"   )
	DetailsWindow "Network Adapter", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsPorts( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_ParallelPort",            "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SerialPort",              "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SerialPortConfiguration", "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_USBController",           "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_SystemSlot",              "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "Win32_PortConnector",           "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/SystemDevices/SystemDevice" )
	End If
	DetailsWindow "Ports and Slots", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsSound( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_SoundDevice", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DirectSound/SoundDevices/SoundDevice" )
	End If
	DetailsWindow "Sound Devices", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsVideo( )
	On Error Resume Next
	gvsDetails = HandleClass( "Win32_VideoController",         "root/CIMV2" ) & vbCrLf & vbCrLf _
	           & HandleClass( "CIM_VideoControllerResolution", "root/CIMV2" )
	If gvbUseDxDiag Then
		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DisplayDevices/DisplayDevice" )
	End If
	DetailsWindow "Display Adapters", gvsDetails
	On Error Goto 0
End Sub


Sub DetailsWindow( strCategory, gvsDetails )
	Dim objDoc, objIE, strHTML

	Set objIE = CreateObject( "InternetExplorer.Application" )
	objIE.Visible        = True
	objIE.Navigate "about:blank"
	objIE.Document.Title = strCategory & " Details for " & gvsComputer & Replace( String( 100, "." ), "..", " ." )
	objIE.ToolBar        = 0
	objIE.StatusBar      = 0
	Set objDoc           = objIE.Document.Body
	strHTML              = "<h1 style=""text-align: center;"">" & strCategory & " details for " & gvsComputer & "</h1>" & vbCrLf _
	                     & "<pre style=""font-family: courier,monospace"">" & gvsDetails & "</pre>"
	objDoc.InnerHTML     = strHTML
End Sub


Sub Download( )
	' Open this HTA's download page
	window.open "http://www.robvanderwoude.com/hardware.php"
End Sub


Sub EDIDTest( ByVal myIndex )
	Dim idx, arrTemp, arrTestModel, arrTestSerial, blnModel, blnSerial, strTemp
	arrTestModel  = Split( "0 0 0 252" )
	arrTestSerial = Split( "0 0 0 255" )
	blnModel      = True
	blnSerial     = True

	For idx = 0 To 3
		If CInt( arrTestModel( idx )  ) <> CInt( gvaRawEDID( idx + myIndex ) ) Then blnModel  = False
		If CInt( arrTestSerial( idx ) ) <> CInt( gvaRawEDID( idx + myIndex ) ) Then blnSerial = False
	Next

	If blnModel Or blnSerial Then
		For idx = 4 To 17
			Select Case gvaRawEDID( myIndex + idx )
				Case 0
					strTemp = strTemp & " "
				Case 7
					strTemp = strTemp & " "
				Case 10
					strTemp = strTemp & " "
				Case 13
					strTemp = strTemp & " "
				Case Else
					strTemp = strTemp & Chr( gvaRawEDID( myIndex + idx ) )
			End Select
		Next
		strTemp = Trim( strTemp )
		If InStr( strTemp, " " ) Then
			arrTemp = Split( strTemp, " " )
			strTemp = arrTemp(0)
		End If
		If blnModel  Then gvsMonitorModel  = strTemp
		If blnSerial Then gvsMonitorSerial = strTemp
	End If
End Sub


Function GetComputerName( )
	Dim objSysInfo

	On Error Resume Next
	GetComputerName = ""
	Set objSysInfo  = CreateObject( "WinNTSystemInfo" )
	GetComputerName = objSysInfo.ComputerName
	On Error Goto 0
End Function


Function GetOSVer( )
	Dim arrOS, colItems, objItem

	GetOSVer = 0

	On Error Resume Next

	Set colItems = gvoWMIService.ExecQuery( "SELECT Version FROM Win32_OperatingSystem" )
	If Not Err Then
		For Each objItem In colItems
			arrOS = Split( objItem.Version, "." )
			If UBound( arrOS ) > 1 Then
				GetOSVer = arrOS(0) & "." & arrOS(1)
			Else
				GetOSVer = arrOS(0)
			End If
		Next
	End If

	On Error Goto 0
End Function


Sub GetAllDiskInterfaces( )
	Dim i, intDescLen, intSizeLen, j, lngSize
	Dim colItems, objItem
	Dim strInterface

	On Error Resume Next
	
	' Query HDD properties and save results in HDD array
	Set colItems = gvoWMIService.ExecQuery( "SELECT Caption,Index,PnpDeviceID,Size FROM Win32_DiskDrive" )
	If Not Err Then
		gviHDD = colItems.Count - 1
		' Adjust size of HDD array
		ReDim gvaHDD( 3, gviHDD )
		For Each objItem in colItems
			With objItem
				If IsNull( objItem.Size ) Then
					lngSize = 0
				Else
					lngSize = CInt( .Size / 1073741824 )
				End If
				strInterface = Split( .PnpDeviceID, "\" )(0)
				If Left( strInterface, 3 ) = "USB" Then strInterface = "USB"
				gvaHDD( 0, .Index ) = .Caption
				gvaHDD( 1, .Index ) = .PnpDeviceID
				gvaHDD( 2, .Index ) = lngSize
				gvaHDD( 3, .Index ) = strInterface
			End With
		Next
	End If
	
	' Count number of CDROM drives, query CDR properties and save results in CDR array
	Set colItems = gvoWMIService.ExecQuery( "SELECT Caption,Drive,PnpDeviceID FROM Win32_CDROMDrive" )
	If Not Err Then
		gviCDROM = colItems.Count - 1
		' Adjust size of CDR array
		ReDim gvaCDROM( 3, gviCDROM )
		i = 0
		For Each objItem in colItems
			With objItem
				strInterface = Split( .PnpDeviceID, "\" )(0)
				If Left( strInterface, 3 ) = "USB" Then strInterface = "USB"
				gvaCDROM( 0, i ) = .Caption
				gvaCDROM( 1, i ) = .PnpDeviceID
				gvaCDROM( 2, i ) = .Drive
				gvaCDROM( 3, i ) = strInterface
			End With
			i = i + 1
		Next
	End If
	
	' Query harddisk controller properties and save results in HDC array
	Set colItems = gvoWMIService.ExecQuery( "SELECT Caption,Description,PnpDeviceID FROM Win32_IDEController" )
	If Not Err Then
		gviHDC = colItems.Count - 1
		' Adjust size of HDC array
		ReDim gvaHDC( 2, gviHDC )
		i = 0
		For Each objItem in colItems
			With objItem
				gvaHDC( 0, i ) = UCase( .Caption & " (" & .Description & ")" )
				gvaHDC( 1, i ) = .PNPDeviceID
				' This is the "weakest link" in this script: distinguishing between IDE and SATA depends on
				' the words "SATA" or "S-ATA" or "Serial ATA" in the harddisk controller's description field
				If InStr( gvaHDC( 0, i ), "SATA" ) Then
					gvaHDC( 2, i ) = "SATA"
				ElseIf InStr( gvaHDC( 0, i ), "S-ATA" ) Then
					gvaHDC( 2, i ) = "SATA"
				ElseIf InStr( gvaHDC( 0, i ), "SERIAL ATA" ) Then
					gvaHDC( 2, i ) = "SATA"
				Else
					gvaHDC( 2, i ) = "IDE"
				End If
			End With
			i = i + 1
		Next
	End If

	Set colItems = gvoWMIService.ExecQuery( "SELECT Caption,Description,PnpDeviceID FROM Win32_SCSIController" )
	If Not Err Then
		If colItems.Count > 0 Then
			gviHDC = gviHDC + colItems.Count
			' Adjust size of HDC array
			ReDim Preserve gvaHDC( 2, gviHDC )
			For Each objItem in colItems
				With objItem
					gvaHDC( 0, i ) = UCase( .Caption & " (" & .Description & ")" )
					gvaHDC( 1, i ) = .PNPDeviceID
					gvaHDC( 2, i ) = "SCSI"
				End With
				i = i + 1
			Next
		End If
	End If

	' Query hosted drives and save results in Host array
	Set colItems = gvoWMIService.ExecQuery( "SELECT Antecedent,Dependent FROM Win32_IDEControllerDevice" )
	If Not Err Then
		gviHost = colItems.Count - 1
		' Adjust size of Host array
		ReDim gvaHost( 2, gviHost )
		i = 0
		For Each objItem in colItems
			With objItem
				gvaHost( 0, i ) = Replace( .Antecedent, "\\", "\", 3 )
				gvaHost( 1, i ) = Replace( .Dependent,  "\\", "\", 3 )
			End With
			i = i + 1
		Next
	End If

	Set colItems = gvoWMIService.ExecQuery( "SELECT Antecedent,Dependent FROM Win32_SCSIControllerDevice" )
	If Not Err Then
		gviHost = gviHost + colItems.Count
		' Adjust size of Host array
		ReDim Preserve gvaHost( 2, gviHost )
		For Each objItem in colItems
			With objItem
				gvaHost( 0, i ) = Replace( .Antecedent, "\\", "\", 3 )
				gvaHost( 1, i ) = Replace( .Dependent,  "\\", "\", 3 )
			End With
			i = i + 1
		Next
	End If
	
	' Check interface per hosted disk
	If gviHost > 0 Then
		For i = 0 To gviHost
			For j = 0 To gviHDC
				If InStr( gvaHost( 0, i ), gvaHDC( 1, j ) ) Then
					gvaHost( 2, i ) = gvaHDC( 2, j )
				End If
			Next
		Next
	End If
	
	' Match hosted disks array with HDD and CDR arrays
	If gviHDD > 0 Then
		For i = 0 To gviHDD
			For j = 0 To gviHost
				If InStr( gvaHost( 1, j ), gvaHDD( 1, i ) ) Then
					gvaHDD( 3, i ) = gvaHost( 2, j )
					' Interface is SATA instead of SCSI if PNPDeviceID starts with IDE
					If gvaHDD( 3, i ) = "SCSI" And Left( gvaHDD( 1, i ), 4 ) = "IDE\" Then
						gvaHDD( 3, i ) = "SATA"
					End If
				End If
			Next
		Next
	End If
	If gviCDROM > 0 Then
		For i = 0 To gviCDROM
			For j = 0 To gviHost
				If InStr( gvaHost( 1, j ), gvaCDROM( 1, i ) ) Then
					gvaCDROM( 3, i ) = gvaHost( 2, j )
					' Interface is SATA instead of SCSI if PNPDeviceID starts with IDE
					If gvaCDROM( 3, i ) = "SCSI" And Left( gvaCDROM( 1, i ), 4 ) = "IDE\" Then
						gvaCDROM( 3, i ) = "SATA"
					End If
				End If
			Next
		Next
	End If

	On Error Goto 0
End Sub


Function HandleClass( myClass, myNameSpace )
' This subroutine lists all properties and their values for a specified class.
' Created using an example from a Microsoft TechNet ScriptCenter article:
' http://www.microsoft.com/technet/scriptcenter/resources/guiguy/default.mspx
	Dim colItems, objClass, objItem, objProperty, objWMIService2, strProperties

	On Error Resume Next

	strProperties = "<h2>\\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & ":" & myClass & "</h2>" & vbCrLf & vbCrLf

	If LCase( myNameSpace ) = "root/cimv2" Then
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM " & myClass )
		Set objClass = gvoWMIService.Get( myClass )
		If Err Then
			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & "\" & myClass & "</p>" & vbCrLf & vbCrLf
			Exit Function
		End If
	Else
		Set objWMIService2 = GetObject( "winmgmts://" & gvsComputer & "/" & myNameSpace )
		If Err Then
			HandleClass = strProperties & "<p>Error while trying to connect to \\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & "</p>" & vbCrLf & vbCrLf
			Exit Function
		End If
		Set colItems = objWMIService2.ExecQuery( "SELECT * FROM " & myClass )
		Set objClass = objWMIService2.Get( myClass )
		If Err Then
			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & "\" & myClass & "</p>" & vbCrLf & vbCrLf
			Exit Function
		End If
	End If

	Select Case colItems.Count
		Case 0
			strProperties = strProperties & "<p>No instances.</p>" & vbCrLf & vbCrLf
		Case 1
			strProperties = strProperties & "<p>1 instance:</p>" & vbCrLf & vbCrLf
		Case Else
			strProperties = strProperties & "<p>" & colItems.Count & " instances:</p>" & vbCrLf & vbCrLf
	End Select

	For Each objItem In colItems
		For Each objProperty In objClass.Properties_
			If objProperty.IsArray = True Then
				strProperties = strProperties & CreateLine( objProperty.Name ) & Eval( "Join( objItem." & objProperty.Name & ", "","" )" ) & vbCrLf
			Else
				If IsDate( Eval( "objItem." & objProperty.Name ) ) Then
					strProperties = strProperties & CreateLine( objProperty.Name ) & FormatDateTime( Eval( "objItem." & objProperty.Name ) ) & vbCrLf
				Else
					strProperties = strProperties & CreateLine( objProperty.Name ) & Eval( "objItem." & objProperty.Name ) & vbCrLf
				End If
			End If
		Next
		strProperties = strProperties & vbCrLf & vbCrLf
	Next

	Set objWMIService2 = Nothing

	On Error Goto 0
   
	HandleClass = strProperties
End Function


Function HandleXMLNode( myQuery )
	Dim i, strDeviceType, strMsg, strQuery2
	Dim colNodes, colNodes2, objNode, objNode2, objNode3, xmlDoc

	HandleXMLNode = ""
	strDeviceType = Left( myQuery, InStrRev( myQuery, "/" ) - 1 )
	strDeviceType = Mid( strDeviceType, InStrRev( strDeviceType, "/" ) + 1 )
	strMsg        = "<h2>\\" & gvsComputer & " " & "DxDiag " & strDeviceType & " data</h2>" & vbCrLf & vbCrLf
	
	On Error Resume Next

	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
	xmlDoc.Async = "False"
	xmlDoc.Load gvsXML

	Set colNodes = xmlDoc.selectNodes( myQuery )

	Select Case colNodes.length
		Case 0
			strMsg = strMsg & "<p>No instances.</p>"
		Case 1
			strMsg = strMsg & "<p>1 instance:</p>"
		Case Else
			strMsg = strMsg & "<p>" & colNodes.length & " instances:</p>"
	End Select

	strMsg = strMsg & vbCrLf & vbCrLf & "<pre>"

	For i = 0 To colNodes.length - 1
		strQuery2 = myQuery & "[" & i & "]/*"
		Set colNodes2 = xmlDoc.selectNodes( strQuery2 )
		For Each objNode2 in colNodes2
			If objNode2.childNodes.length = 1 Then
				strMsg = strMsg & objNode2.nodeName & " = " & objNode2.text & vbCrLf
			Else
				strMsg = strMsg & objNode2.nodeName & ":" & vbCrLf
				For Each objNode3 In objNode2.childNodes
					strMsg = strMsg & "  " & objNode3.nodeName & " = " & objNode3.text & vbCrLf
				Next
			End If
		Next
		strMsg = strMsg & vbCrLf & vbCrLf
	Next

	strMsg = strMsg & "</pre>" & vbCrLf

	Set colNodes2 = Nothing
	Set colNodes  = Nothing
	Set xmlDoc    = Nothing

	On Error Goto 0

	HandleXMLNode = strMsg
End Function


Function HandleXMLValue( myQuery )
	Dim i, strDeviceType, strMsg, strQuery2
	Dim colNodes, colNodes2, objNode, objNode2, objNode3, xmlDoc

	HandleXMLValue = ""
	strDeviceType  = Left( myQuery, InStrRev( myQuery, "/" ) - 1 )
	strDeviceType  = Mid( strDeviceType, InStrRev( strDeviceType, "/" ) + 1 )
	strMsg         = "<h2>\\" & gvsComputer & " " & "DxDiag " & strDeviceType & " data</h2>" & vbCrLf & vbCrLf
	
	On Error Resume Next

	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
	xmlDoc.Async = "False"
	xmlDoc.Load gvsXML

	Set colNodes = xmlDoc.selectNodes( myQuery )

	Select Case colNodes.length
		Case 0
			strMsg = strMsg & "<p>No instances.</p>"
		Case 1
			strMsg = strMsg & "<p>1 instance:</p>"
		Case Else
			strMsg = strMsg & "<p>" & colNodes.length & " instances:</p>"
	End Select

	strMsg = strMsg & vbCrLf & vbCrLf & "<pre>"

	For i = 0 To colNodes.length - 1
		strQuery2 = myQuery & "[" & i & "]"
		Set colNodes2 = xmlDoc.selectNodes( strQuery2 )
		For Each objNode2 in colNodes2
			strMsg = strMsg & objNode2.nodeName & " #" & i & " : " & objNode2.text & vbCrLf
		Next
		strMsg = strMsg & vbCrLf & vbCrLf
	Next

	strMsg = strMsg & "</pre>" & vbCrLf

	Set colNodes2 = Nothing
	Set colNodes  = Nothing
	Set xmlDoc    = Nothing

	On Error Goto 0

	HandleXMLValue = strMsg
End Function


Sub HelpMsg( )
	Dim strHTML
	strHTML = "<p><strong>Basic Hardware Inventory,  Version " & HardwInv.Version & "</strong></p>" _
	       & vbCrLf & vbCrLf _
	       & "<p>Get a basic hardware inventory of any WMI enabled computer on the network</p>" _
	       & vbCrLf & vbCrLf _
	       & "<table style=""font-size: 10pt;"">" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><strong>Usage:</strong></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"" colspan=""3""><code>HARDWARE.HTA  [ options ]</code></td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""5"">&nbsp;</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><strong>Options:</strong></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/HELP</code> or <code>/?</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Show this message</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/BASIC</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Very basic inventory (CPU, memory, HDD)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/CM</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Display monitor dimensions in centimeters instead of diagonal in inches (only in Windows Vista and later)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/COMPUTER:<em>name</em></code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Specify computer to be queried (starts inventory immediately)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/COPY</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Copy results to clipboard and close program (starts inventory immediately, and terminates program when results are copied)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/DXDIAG</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Use DxDiag.exe to retrieve sound devices, video controllers and system data (more reliable than WMI for video and sound, but <em>slow</em>, and for <em>local computer only</em>)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/KEEPXML</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Reuse existing DxDiag data saved in XML, if it exists, and do not delete the XML file when terminating the program (requires <code>/DXDIAG</code>)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/NOUPDCHK</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Skip check for updates at startup</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/PRINT</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Print the results to the default printer (starts inventory immediately, and terminates program when results are printed)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/SAVE:<em>filename</em></code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Save tab delimited results; if <em>csvfile</em> equals ""*"", you will be prompted for a file name; if <em>csvfile</em> is not specified, ""Hardware.csv"" in the current directory will be used (starts inventory immediately, and terminates program <em>if</em> and <em>when</em> results are written to file)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/SIZE:<em>W</em>x<em>H</em></code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Center window and resize to <em>W</em> x <em>H</em> pixels</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/USBSTOR</code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Include USB drives in the harddisks list</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><code>/XML:<em>xmlfile</em></code></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top"">Location where DxDiag results will be stored; if <em>xmlfile</em> is not specified, ""Hardware.xml"" in the current directory will be used (requires <code>/DXDIAG</code>)</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""5"">&nbsp;</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><strong>Notes:</strong></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td colspan=""3"" style=""vertical-align: top"">At startup, the program looks for a file named ""Hardware.cfg"" in its working directory." _
	       & vbCrLf _
	       & "        If it finds it, it will append the first line to the command line." _
	       & vbCrLf _
	       & "        In case of conflicts, the command line parameters will prevail." _
	       & vbCrLf _
	       & "        Use the ""Settings"" button to create or edit ""Hardware.cfg"".<br>" _
	       & vbCrLf _
	       & "        ""Hardware.cfg"" might look like this:<br>" _
	       & vbCrLf _
	       & "        <code>/DxDiag /KeepXML /USBStor</code></td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""5"">&nbsp;</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td style=""vertical-align: top""><strong>Examples:</strong></td>" _
	       & vbCrLf _
	       & "    <td>&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td colspan=""3"" style=""vertical-align: top""><code>HARDWARE.HTA /Size:1024x768 /DxDiag /KeepXML /USBStor</code></td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""5"">&nbsp;</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td colspan=""3"" style=""vertical-align: top""><code>HARDWARE.HTA /NoUpdChk /DxDiag /Save:%ComputerName%_Full_Inventory.csv</code></td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""5"">&nbsp;</td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "<tr>" _
	       & vbCrLf _
	       & "    <td colspan=""2"">&nbsp;</td>" _
	       & vbCrLf _
	       & "    <td colspan=""3"" style=""vertical-align: top""><code>HARDWARE.HTA /NoUpdChk /Basic /Computer:REMOTEPC /Save:REMOTEPC_Basic_Inventory.csv</code></td>" _
	       & vbCrLf _
	       & "</tr>" _
	       & vbCrLf _
	       & "</table>" _
	       & vbCrLf & vbCrLf _
	       & "<p>If you like this program, why not show your appreciation by making a donation?</p>" _
	       & vbCrLf & vbCrLf _
	       & "<p>Click <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""Donate"" onclick=""window.open('http://www.robvanderwoude.com/donate.php')""> or navigate to <a href=""http://www.robvanderwoude.com/donate.php"">http://www.robvanderwoude.com/donate.php</a></p>" _
	       & vbCrLf & vbCrLf _
	       & "<p>&copy; 2005 - 2012, Rob van der Woude<br>" _
	       & vbCrLf _
	       & "<a href=""http://www.robvanderwoude.com/hardware.php"">http://www.robvanderwoude.com/hardware.php</a></p>"

	On Error Resume Next
	CreateIEHelp
	While gvoIEHelp.Busy
		Sleep 1
	Wend
	gvoIEHelp.Navigate "about:blank"
	On Error Goto 0

	gvoIEHelp.Width  = Min( Min( gviReqWidth, 1024 ), window.screen.width  )
	gvoIEHelp.Height = Min( Min( gviReqHeight, 870 ), window.screen.height )
	gvoIEHelp.Left   = Int( ( window.screen.width  - gvoIEHelp.Width  ) / 2 )
	gvoIEHelp.Top    = Int( ( window.screen.height - gvoIEHelp.Height ) / 2 )
	gvoIEHelp.StatusBar  = False
	gvoIEHelp.AddressBar = False
	gvoIEHelp.MenuBar    = False
	gvoIEHelp.ToolBar    = False
	gvoIEHelp.Document.Title = "Basic Hardware Inventory (Version " & HardwInv.Version & ") © Rob van der Woude 2005-2012"
	gvoIEHelp.Document.Body.style.fontFamily = "arial,sans-serif"
	gvoIEHelp.Document.Body.InnerHTML = strHTML
	gvoIEHelp.Visible = True
End Sub


Sub HideUpdateNotification( )
	UpdateBlock.style.display = "none"
End Sub


Function IE7( )
	' Returns True if IE version is 7 or less
	Dim objReg, strIEVer, strWMIQuery

	Const HKEY_LOCAL_MACHINE = &H80000002

	IE7 = False

	On Error Resume Next

	gvsComputer = Trim( ComputerName.Value )
	If gvsComputer = "" Or gvsComputer = "." Then
		gvsComputer        = GetComputerName( )
		ComputerName.Value = gvsComputer
	End If

	' Read the IE version from the registry
	strWMIQuery = "winmgmts:{impersonationLevel=impersonate}!//" & gvsComputer & "/root/default:StdRegProv"
	Set objReg = GetObject( strWMIQuery )
	objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Internet Explorer", "Version", strIEVer
	Set objReg = Nothing

	If CLng( Split( strIEVer, "." )(0) ) < 8 Then IE7 = True

	On Error Goto 0
End Function


Sub Initialize( )
	gvbUpdateCheck     = True
	gvbDisplaySizeInCm = False
	gvbFullInventory   = True
	gvbUSBSTOR         = False
	gvbUseDxDiag       = False
	gvbIE7             = False
	gvbTest            = False

	gvsCmdLine       = UCase( HardwInv.CommandLine )
	gvbKeepXML       = False
	gvsTableRowStyle = "table-row"

	gvsHTAPath    = location.pathname
	gvsHTAPath    = Left( gvsHTAPath, InStrRev( gvsHTAPath, "\" ) )
	gvsCSVTxtFile = gvsHTAPath & "Hardware.csv"
	gvsXML        = gvsHTAPath & "Hardware.xml"

	' Reset counters
	gvcBanks   = 0
	gvcCDROM   = 0
	gvcCPU     = 0
	gvcHDD     = 0
	gvcMemory  = 0
	gvcMonitor = 0
	gvcNIC     = 0
	gvcVideo   = 0

	gviMemSize   = 0
	gviMemSpeed  = 0
	gviNumOS     = 0
	gviReqHeight = window.screen.height
	gviReqWidth  = window.screen.width

	' Color changes on WMI connection errors
	clrBgErr  = "Red"
	clrTxtErr = "White"

	' Global File System Object
	Set gvoFSO = CreateObject( "Scripting.FileSystemObject" )
End Sub


Sub Inventory( )
	Dim blnSuccess, colItems, i, objItem

	CheckboxBIOS.Disabled      = True
	CheckboxCDROM.Disabled     = True
	CheckboxCPU.Disabled       = True
	CheckboxHDD.Disabled       = True
	CheckboxMainBoard.Disabled = True
	CheckboxMemory.Disabled    = True
	CheckboxMonitor.Disabled   = True
	CheckboxNIC.Disabled       = True
	CheckboxPorts.Disabled     = True
	CheckboxSound.Disabled     = True
	CheckboxVideo.Disabled     = True
	ButtonBasic.Disabled       = True
	ButtonPaste.Disabled       = True
	ButtonPrint.Disabled       = True
	ButtonRun.Disabled         = True
	ButtonReset.Disabled       = True
	ComputerName.Disabled      = True

	If Not CheckboxBIOS.Checked Then
		BIOSHeader.style.display = "none"
		BIOSRow.style.display    = "none"
		BIOSFooter.style.display = "none"
	End If
	If Not CheckboxCDROM.Checked Then
		CDROMHeader.style.display = "none"
		CDROM0.style.display      = "none"
		CDROM1.style.display      = "none"
		CDROM2.style.display      = "none"
		CDROM3.style.display      = "none"
		CDROMFooter.style.display = "none"
	End If
	If Not CheckboxCPU.Checked Then
		CPUHeader.style.display = "none"
		CPURow.style.display    = "none"
		CPUFooter.style.display = "none"
	End If
	If Not CheckboxHDD.Checked Then
		HardDiskHeader.style.display = "none"
		HardDisk0.style.display      = "none"
		HardDisk1.style.display      = "none"
		HardDisk2.style.display      = "none"
		HardDisk3.style.display      = "none"
		HardDisk4.style.display      = "none"
		HardDisk5.style.display      = "none"
		HardDisk6.style.display      = "none"
		HardDisk7.style.display      = "none"
		HardDiskFooter.style.display = "none"
	End If
	If Not CheckboxMainBoard.Checked Then
		MainBoardHeader.style.display = "none"
		MainBoardRow.style.display    = "none"
		MainBoardFooter.style.display = "none"
	End If
	If Not CheckboxMemory.Checked Then
		MemHeader.style.display = "none"
		MemRow.style.display    = "none"
		MemFooter.style.display = "none"
	End If
	If Not CheckboxMonitor.Checked Then
		MonitorHeader.style.display = "none"
		Monitor0.style.display      = "none"
		Monitor1.style.display      = "none"
		Monitor2.style.display      = "none"
		Monitor3.style.display      = "none"
		MonitorFooter.style.display = "none"
	End If
	If Not CheckboxNIC.Checked Then
		NICHeader.style.display = "none"
		NIC0.style.display      = "none"
		NIC1.style.display      = "none"
		NIC2.style.display      = "none"
		NIC3.style.display      = "none"
		NICFooter.style.display = "none"
	End If
	If Not CheckboxPorts.Checked Then
		PortsHeader.style.display = "none"
		PortsRow.style.display    = "none"
		PortsFooter.style.display = "none"
	End If
	If Not CheckboxSound.Checked Then
		SoundHeader.style.display = "none"
		SoundRow.style.display    = "none"
		SoundFooter.style.display = "none"
	End If
	If Not CheckboxVideo.Checked Then
		VideoHeader.style.display = "none"
		Video0.style.display      = "none"
		Video1.style.display      = "none"
		Video2.style.display      = "none"
		Video3.style.display      = "none"
		VideoFooter.style.display = "none"
	End If

	On Error Resume Next

	gvsComputer = Trim( ComputerName.Value )
	If gvsComputer = "" Or gvsComputer = "." Then
		gvsComputer        = GetComputerName( )
		ComputerName.Value = gvsComputer
	End If

	Sleep 1

	Set gvoWMIService = GetObject( "winmgmts://./root/CIMV2" )
	Set colItems = gvoWMIService.ExecQuery( "SELECT StatusCode FROM Win32_PingStatus WHERE Address='" & gvsComputer & "'" )
	For Each objItem In colItems
		If IsNull( objItem.StatusCode ) Or objItem.StatusCode <> 0 Then
			MsgBox "Error while trying to ping computer " & gvsComputer & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Connection Error"
			Location.Reload( True )
			Exit Sub
		End If
	Next

	Set gvoWMIService = GetObject( "winmgmts://" & gvsComputer & "/root/CIMV2" )
	If Err Then
		MsgBox "Error while trying to connect to computer " & gvsComputer & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "WMI Error"
		Location.Reload( True )
		Exit Sub
	Else
		ButtonRun.Disabled                 = True
		ComputerName.Style.backgroundColor = "White"
		ComputerName.Style.Color           = "Black"
		ComputerName.Disabled              = True
	End If

	gviNumOS = GetOSVer( )

	On Error Goto 0

	gvsHeader = "Computer:"
	gvsCSVTxt = gvsComputer

	InventoryCPU( gvsComputer )
	InventoryMemory( gvsComputer )
	GetAllDiskInterfaces
	InventoryHDD( gvsComputer )
	InventoryCDROM( gvsComputer )
	InventoryVideo( gvsComputer )
	InventoryMonitor( gvsComputer )
	InventorySound( gvsComputer )
	InventoryNIC( gvsComputer )
	InventoryMainBoard( gvsComputer )
	InventoryPorts( gvsComputer )
	InventoryBIOS( gvsComputer )

	If gvbUseDxDiag Then
		If CheckboxVideo.Checked Then
			blnSuccess = InventoryDirectX( )
			If blnSuccess Then
				On Error Resume Next
		
				For i = 0 To UBound( gvaVideo, 2 )
					Select Case i
						Case 0
							VideoIndex0.Value  = 0
							VideoModel0.Value  = gvaVideo( 4, 0 )
							VideoMemory0.Value = gvaVideo( 0, 0 )
							VideoMode0.Value   = gvaVideo( 1, 0 )
							ButtonDetailsVideo.Disabled = False
						Case 1
							Video1.style.display = gvsTableRowStyle
							VideoIndex1.Value    = 1
							VideoModel1.Value    = gvaVideo( 4, 1 )
							VideoMemory1.Value   = gvaVideo( 0, 1 )
							VideoMode1.Value     = gvaVideo( 1, 1 )
						Case 2
							Video2.style.display = gvsTableRowStyle
							VideoIndex2.Value    = 2
							VideoModel2.Value    = gvaVideo( 4, 2 )
							VideoMemory2.Value   = gvaVideo( 0, 2 )
							VideoMode2.Value     = gvaVideo( 1, 2 )
						Case 3
							Video3.style.display = gvsTableRowStyle
							VideoIndex3.Value    = 3
							VideoModel3.Value    = gvaVideo( 4, 3 )
							VideoMemory3.Value   = gvaVideo( 0, 3 )
							VideoMode3.Value     = gvaVideo( 1, 3 )
					End Select
					
				Next
		
				On Error Goto 0
			Else
				MsgBox "There was an error reading the DirectX data:" & vbCrLf & "Unable to load """ & gvsXML & """", vbOKOnly, "XML error"
			End If
		End If
	End If

	gvsHeader = gvsHeader                   & vbTab _
	          & "Video Card 0 Model:"       & vbTab _
	          & "Video Card 0 Memory (MB):" & vbTab _
	          & "Video Card 0 Video Mode:"  & vbTab _
	          & "Video Card 1 Model:"       & vbTab _
	          & "Video Card 1 Memory (MB):" & vbTab _
	          & "Video Card 1 Video Mode:"  & vbTab _
	          & "Video Card 2 Model:"       & vbTab _
	          & "Video Card 2 Memory (MB):" & vbTab _
	          & "Video Card 2 Video Mode:"  & vbTab _
	          & "Video Card 3 Model:"       & vbTab _
	          & "Video Card 3 Memory (MB):" & vbTab _
	          & "Video Card 3 Video Mode:"
	gvsCSVTxt = gvsCSVTxt                   & vbTab _
	          & VideoModel0.Value           & vbTab _
	          & VideoMemory0.Value          & vbTab _
	          & VideoMode0.Value            & vbTab _
	          & VideoModel1.Value           & vbTab _
	          & VideoMemory1.Value          & vbTab _
	          & VideoMode1.Value            & vbTab _
	          & VideoModel2.Value           & vbTab _
	          & VideoMemory2.Value          & vbTab _
	          & VideoMode2.Value            & vbTab _
	          & VideoModel3.Value           & vbTab _
	          & VideoMemory3.Value          & vbTab _
	          & VideoMode3.Value

	If gvbTest Then
		ComputerName.Value = "MYPC"
	Else
		ComputerName.Value = gvsComputer
	End If

	ButtonCopy.Disabled  = False
	ButtonReset.Disabled = False
	ButtonPrint.Disabled = False
	ButtonSave.Disabled  = False
	ButtonSave.Focus( )
End Sub


Sub InventoryBIOS( gvsComputer )
	Dim colItems, objItem, strBIOSDate, strBIOSVersion

	On Error Resume Next

	If CheckBoxBIOS.Checked Then
		Set colItems = gvoWMIService.ExecQuery( "SELECT Manufacturer,Name,ReleaseDate,Version FROM Win32_BIOS WHERE PrimaryBIOS = True" )
		If Not Err Then
			For Each objItem In colItems
				strBIOSVersion = objItem.Version
				strBIOSDate    = Mid( objItem.ReleaseDate, 5, 2 ) & "/" & Mid( objItem.ReleaseDate, 7, 2 ) & "/" & Left( objItem.ReleaseDate, 4 )
				If gvbTest Then
					strBIOSVersion = "0.00"
					strBIOSDate    = "12/31/1980"
				End If
				BIOSManufacturer.Value = objItem.Manufacturer
				BIOSModel.Value        = objItem.Name
				BIOSVersion.Value      = strBIOSVersion
				BIOSDate.Value         = strBIOSDate
			Next
		End If

		On Error Goto 0

		ButtonDetailsBIOS.Disabled = False

		gvsHeader = gvsHeader              & vbTab _
		          & "BIOS Manufacturer:"   & vbTab _
		          & "BIOS Model:"          & vbTab _
		          & "BIOS Version:"        & vbTab _
		          & "BIOS Date:"
		gvsCSVTxt = gvsCSVTxt              & vbTab _
		          & BIOSManufacturer.Value & vbTab _
		          & BIOSModel.Value        & vbTab _
		          & BIOSVersion.Value      & vbTab _
		          & BIOSDate.Value
	End If
End Sub


Sub InventoryCDROM( gvsComputer )
	Dim arrDeviceID, arrFirmware
	Dim colItems, objItem
	Dim strCDROM, strDeviceID, strElement, strFirmware, strInterface

	If CheckboxCDROM.Checked Then
		On Error Resume Next

		Set colItems = gvoWMIService.ExecQuery( "SELECT DeviceID,Drive,Name FROM Win32_CDROMDrive" )
		If Not Err Then
			For Each objItem In colItems
				' Parse the PNP Device ID string to get the interface and firmware revision
				' Example:
				' IDE\CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____\5&2E27B08F&0&0.0.0
				' ===  <-  interface                               ====  <-  firmware revision
				' The array arrDeviceID will contain 3 elements: "IDE",
				' "CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____" and "5&2E27B08F&0&0.0.0"
				arrDeviceID  = Split( objItem.DeviceID, "\", 3, vbTextCompare )
				strInterface = arrDeviceID(0)
				strDeviceID  = arrDeviceID(1)
				' In our example, strDeviceID will contain "CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____"
				' The array arrFirmware will contain the elements "CDROM", "NEC", "DVD", "RW", "ND-3520AW", "3.05" and ""
				' strFirmware is assigned the value of the last non-empty element in the array
				arrFirmware  = Split( strDeviceID, "_", -1, vbTextCompare )
				If Left( strInterface, 3 ) = "USB" Then strInterface = "USB"
				For Each strElement In arrFirmware
					If CStr( strElement ) <> "" Then strFirmware = strElement
				Next
	
				Select Case gvcCDROM
					Case 0
						CDROM0Index.Value     = objItem.Drive
						CDROM0Model.Value     = objItem.Name
						CDROM0Firmware.Value  = strFirmware
						CDROM0Interface.Value = gvaCDROM( 3, 0 )
						ButtonDetailsCDROMOM.Disabled = False
					Case 1
						MultipleCDROMs.style.display = "inline"
						CDROM1.style.display  = gvsTableRowStyle
						CDROM1Index.Value     = objItem.Drive
						CDROM1Model.Value     = objItem.Name
						CDROM1Firmware.Value  = strFirmware
						CDROM1Interface.Value = gvaCDROM( 3, 1 )
					Case 2
						CDROM2.style.display  = gvsTableRowStyle
						CDROM2Index.Value     = objItem.Drive
						CDROM2Model.Value     = objItem.Name
						CDROM2Firmware.Value  = strFirmware
						CDROM2Interface.Value = gvaCDROM( 3, 2 )
					Case 3
						CDROM3.style.display  = gvsTableRowStyle
						CDROM3Index.Value     = objItem.Drive
						CDROM3Model.Value     = objItem.Name
						CDROM3Firmware.Value  = strFirmware
						CDROM3Interface.Value = gvaCDROM( 3, 3 )
				End Select
				gvcCDROM = gvcCDROM + 1
			Next
	
			If gvcCDROM > 4 Then
				CDROM3Index.Value = CDROM3Index.Value & "*"
			End If
		End If

		On Error Goto 0

		gvsHeader = gvsHeader             & vbTab _
		          & "CDROM 0 Model:"      & vbTab _
		          & "CDROM 0 Firmware:"   & vbTab _
		          & "CDROM 0 Interface:"  & vbTab _
		          & "CDROM 1 Model:"      & vbTab _
		          & "CDROM 1 Firmware:"   & vbTab _
		          & "CDROM 1 Interface:"  & vbTab _
		          & "CDROM 2 Model:"      & vbTab _
		          & "CDROM 2 Firmware:"   & vbTab _
		          & "CDROM 2 Interface:"  & vbTab _
		          & "CDROM 3 Model:"      & vbTab _
		          & "CDROM 3 Firmware:"   & vbTab _
		          & "CDROM 3 Interface:"
		gvsCSVTxt = gvsCSVTxt             & vbTab _
		          & CDROM0Model.Value     & vbTab _
		          & CDROM0Firmware.Value  & vbTab _
		          & CDROM0Interface.Value & vbTab _
		          & CDROM1Model.Value     & vbTab _
		          & CDROM1Firmware.Value  & vbTab _
		          & CDROM1Interface.Value & vbTab _
		          & CDROM2Model.Value     & vbTab _
		          & CDROM2Firmware.Value  & vbTab _
		          & CDROM2Interface.Value & vbTab _
		          & CDROM3Model.Value     & vbTab _
		          & CDROM3Firmware.Value  & vbTab _
		          & CDROM3Interface.Value
	End If
End Sub


Sub InventoryCPU( gvsComputer )
	Dim colItems, objItem

	If CheckBoxCPU.Checked Then
		On Error Resume Next

		Set colItems = gvoWMIService.ExecQuery( "SELECT CurrentClockSpeed,Name,SocketDesignation FROM Win32_Processor" )
		If Not Err Then
			gvcCPU = colItems.Count
			CPUNumber.Value = gvcCPU
			If gvcCPU > 1 Then MultipleCPU.InnerHTML  = "s"
			For Each objItem In colItems
				CPUModel.Value  = Trim( objItem.Name )
				CPUSpeed.Value  = objItem.CurrentClockSpeed
				CPUSocket.Value = objItem.SocketDesignation
			Next
		End If

		On Error Goto 0

		ButtonDetailsCPU.Disabled = False

		gvsHeader = gvsHeader       & vbTab _
		          & "# CPUs:"       & vbTab _
	              & "CPU Type:"     & vbTab _
	              & "CPU Speed:"    & vbTab _
	              & "CPU Socket:"
		gvsCSVTxt = gvsCSVTxt       & vbTab _
	              & CPUNumber.Value & vbTab _
	              & CPUModel.Value  & vbTab _
	              & CPUSpeed.Value  & vbTab _
	              & CPUSocket.Value
	End If
End Sub


Function InventoryDirectX( )
	Dim blnLoaded, i
	Dim colItems, colNodes, objItem, objNode, wshShell, xmlDoc
	Dim strDxDiag, strQuery, strSysDir

	Set wshShell = CreateObject( "Wscript.Shell" )
	strSysDir = wshShell.ExpandEnvironmentStrings( "%Windir%\System32" )
	strDxDiag = gvoFSO.BuildPath( strSysDir, "DxDiag.exe" )

	' Delete old XML file if it exists, unless specified otherwise
	If Not gvbKeepXML Then
		If gvoFSO.FileExists( gvsXML ) Then gvoFSO.DeleteFile gvsXML, True
	End If

	' Run DXDIAG.EXE, if required, and save results in XML file
	If gvoFSO.FileExists( gvsXML ) Then
		If Not gvbKeepXML Then
			gvoFSO.DeleteFile gvsXML, True
			Sleep 2
			wshShell.Run strDxDiag & " /whql:off /x " & gvsXML, 7, False
		End If
	Else
		wshShell.Run strDxDiag & " /whql:off /x " & gvsXML, 7, False
	End If

	' Wait until XML file is created, 5 minutes maximum
	For i = 1 To 150
		Sleep 1
		If gvoFSO.FileExists( gvsXML ) Then Exit For
		Sleep 1
	Next

	' Wait for DXDIAG to close, 30 seconds maximum
	Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_Process WHERE Caption='DxDiag.exe'" )
	For i = 1 To 5
		If colItems.count = 0 Then Exit For
		Sleep 6
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_Process WHERE Caption='DxDiag.exe'" )
	Next

	' Open the XML file created by DXDIAG
	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
	xmlDoc.Async = "False"
	blnLoaded = xmlDoc.Load( gvsXML )
	If Not blnLoaded Then
		' Retry 5 times maximum, with 6 seconds interval
		For i = 1 To 15
			Sleep 2
			blnLoaded = xmlDoc.Load( gvsXML )
			If blnLoaded Then Exit For
		Next
		Sleep 2
		MsgBox "Process DxDiag.exe still running", vbOKOnly, "DxDiag error"
	End If

	If blnLoaded Then
		ReDim gvaVideo( 4, 0 )
	
		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/DisplayMemory"
		Set colNodes = xmlDoc.selectNodes( strQuery )
		i = 0
		For Each objNode in colNodes
			ReDim Preserve gvaVideo( 4, i )
			gvaVideo( 0, i ) = Trim( Replace( objNode.text, "MB", "" ) )
			i = i + 1
		Next
	
		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/CurrentMode"
		Set colNodes = xmlDoc.selectNodes( strQuery )
		i = 0
		For Each objNode in colNodes
			gvaVideo( 1, i ) = Trim( objNode.text )
			i = i + 1
		Next
	
		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/MonitorName"
		Set colNodes = xmlDoc.selectNodes( strQuery )
		i = 0
		For Each objNode in colNodes
			gvaVideo( 2, i ) = Trim( objNode.text )
			i = i + 1
		Next
	
		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/MonitorModel"
		Set colNodes = xmlDoc.selectNodes( strQuery )
		i = 0
		For Each objNode in colNodes
			gvaVideo( 3, i ) = Trim( objNode.text )
			i = i + 1
		Next
	
		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/CardName"
		Set colNodes = xmlDoc.selectNodes( strQuery )
		i = 0
		For Each objNode in colNodes
			gvaVideo( 4, i ) = Trim( objNode.text )
			i = i + 1
		Next
		
		InventoryDirectX = True
	Else
		InventoryDirectX = False
	End If

	' Clean up
	Set colNodes = Nothing
	Set xmlDoc   = Nothing
	Set wshShell = Nothing
End Function


Sub InventoryHDD( gvsComputer )
	Dim arrIndex, colItems, intDisk, objItem, strQuery

	If CheckboxHDD.Checked Then
		On Error Resume Next

		If gvbUSBSTOR Then
			strQuery = "SELECT Index,Model,Size FROM Win32_DiskDrive WHERE Size > 0"
		Else
			strQuery = "SELECT Index,Model,SCSITargetId,Size FROM Win32_DiskDrive WHERE SCSITargetId >= 0"
		End If
		Set colItems = gvoWMIService.ExecQuery( strQuery )
		If Not Err Then
			gvcHDD = colItems.Count
			' We will use a sorted ArrayList to store the disk index numbers of all disks with sizes greater than 0
			Set arrIndex = CreateObject( "System.Collections.ArrayList" )
			arrIndex.Clear
			For Each objItem In colItems
				If objItem.Size > 0 Then arrIndex.Add objItem.Index
			Next
			arrIndex.Sort
			For Each objItem In colItems
				intDisk = arrIndex.IndexOf( objItem.Index, 0 )
				Select Case intDisk
					Case 0
						HardDisk0Index.Value       = objItem.Index
						HardDisk0Model.Value       = objItem.Model
						HardDisk0Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk0Interface.Value   = gvaHDD( 3, 0 )
						ButtonDetailsHDD.Disabled  = False
					Case 1
						HardDisk1.style.display    = gvsTableRowStyle
						MultipleHDUs.style.display = "inline"
						HardDisk1Index.Value       = objItem.Index
						HardDisk1Model.Value       = objItem.Model
						HardDisk1Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk1Interface.Value   = gvaHDD( 3, 1 )
					Case 2
						HardDisk2.style.display    = gvsTableRowStyle
						HardDisk2Index.Value       = objItem.Index
						HardDisk2Model.Value       = objItem.Model
						HardDisk2Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk2Interface.Value   = gvaHDD( 3, 2 )
					Case 3
						HardDisk3.style.display    = gvsTableRowStyle
						HardDisk3Index.Value       = objItem.Index
						HardDisk3Model.Value       = objItem.Model
						HardDisk3Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk3Interface.Value   = gvaHDD( 3, 3 )
					Case 4
						HardDisk4.style.display    = gvsTableRowStyle
						HardDisk4Index.Value       = objItem.Index
						HardDisk4Model.Value       = objItem.Model
						HardDisk4Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk4Interface.Value   = gvaHDD( 3, 4 )
					Case 5
						HardDisk5.style.display    = gvsTableRowStyle
						HardDisk5Index.Value       = objItem.Index
						HardDisk5Model.Value       = objItem.Model
						HardDisk5Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk5Interface.Value   = gvaHDD( 3, 5 )
					Case 6
						HardDisk6.style.display    = gvsTableRowStyle
						HardDisk6Index.Value       = objItem.Index
						HardDisk6Model.Value       = objItem.Model
						HardDisk6Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk6Interface.Value   = gvaHDD( 3, 6 )
					Case 7
						HardDisk7.style.display    = gvsTableRowStyle
						HardDisk7Index.Value       = objItem.Index
						HardDisk7Model.Value       = objItem.Model
						HardDisk7Size.Value        = Round( objItem.Size / 1073741824 )
						HardDisk7Interface.Value   = gvaHDD( 3, 7 )
					Case Else
						HardDisk0Index.Value = HardDisk0Index.Value & "*"
				End Select
			Next

'			If gvcHDD > 8 Then
'				HardDisk7Index.Value = HardDisk7Index.Value & "*"
'			End If
		End If

		On Error Goto 0

		gvsHeader = gvsHeader & vbTab _
		          & "HDD 0 Model:"           & vbTab _
		          & "HDD 0 Size (GB):"       & vbTab _
		          & "HDD 0 Interface:"       & vbTab _
		          & "HDD 1 Model:"           & vbTab _
		          & "HDD 1 Size (GB):"       & vbTab _
		          & "HDD 1 Interface:"       & vbTab _
		          & "HDD 2 Model:"           & vbTab _
		          & "HDD 2 Size (GB):"       & vbTab _
		          & "HDD 2 Interface:"       & vbTab _
		          & "HDD 3 Model:"           & vbTab _
		          & "HDD 3 Size (GB):"       & vbTab _
		          & "HDD 3 Interface:"       & vbTab _
		          & "HDD 4 Model:"           & vbTab _
		          & "HDD 4 Size (GB):"       & vbTab _
		          & "HDD 4 Interface:"       & vbTab _
		          & "HDD 5 Model:"           & vbTab _
		          & "HDD 5 Size (GB):"       & vbTab _
		          & "HDD 5 Interface:"       & vbTab _
		          & "HDD 6 Model:"           & vbTab _
		          & "HDD 6 Size (GB):"       & vbTab _
		          & "HDD 6 Interface:"       & vbTab _
		          & "HDD 7 Model:"           & vbTab _
		          & "HDD 7 Size (GB):"       & vbTab _
		          & "HDD 7 Interface:"
		gvsCSVTxt = gvsCSVTxt                & vbTab _
		          & HardDisk0Model.Value     & vbTab _
		          & HardDisk0Size.Value      & vbTab _
		          & HardDisk0Interface.Value & vbTab _
		          & HardDisk1Model.Value     & vbTab _
		          & HardDisk1Size.Value      & vbTab _
		          & HardDisk1Interface.Value & vbTab _
		          & HardDisk2Model.Value     & vbTab _
		          & HardDisk2Size.Value      & vbTab _
		          & HardDisk2Interface.Value & vbTab _
		          & HardDisk3Model.Value     & vbTab _
		          & HardDisk3Size.Value      & vbTab _
		          & HardDisk3Interface.Value & vbTab _
		          & HardDisk4Model.Value     & vbTab _
		          & HardDisk4Size.Value      & vbTab _
		          & HardDisk4Interface.Value & vbTab _
		          & HardDisk5Model.Value     & vbTab _
		          & HardDisk5Size.Value      & vbTab _
		          & HardDisk5Interface.Value & vbTab _
		          & HardDisk6Model.Value     & vbTab _
		          & HardDisk6Size.Value      & vbTab _
		          & HardDisk6Interface.Value & vbTab _
		          & HardDisk7Model.Value     & vbTab _
		          & HardDisk7Size.Value      & vbTab _
		          & HardDisk7Interface.Value
	End If
End Sub


Sub InventoryMainBoard( gvsComputer )
	Dim colItems, objItem, strMBVersion

	If CheckboxMainBoard.Checked Then
		On Error Resume Next

		Set colItems = gvoWMIService.ExecQuery( "SELECT Manufacturer,Product,Version FROM Win32_BaseBoard" )
		If Not Err Then
			For Each objItem In colItems
				If gvbTest Then
					strMBVersion = "0.00"
				Else
					strMBVersion = objItem.Version
				End If
				MBManufacturer.Value = objItem.Manufacturer
				MBModel.Value        = objItem.Product
				MBVersion.Value      = strMBVersion
			Next
		End If

		On Error Goto 0

		ChassisType.Value = Chassis( gvsComputer )

		ButtonDetailsMainBoard.Disabled = False

		gvsHeader = gvsHeader            & vbTab _
		          & "Chassis:"           & vbTab _
		          & "MB Manufacturer:"   & vbTab _
		          & "MB Model:"          & vbTab _
		          & "MB Version:"
		gvsCSVTxt = gvsCSVTxt            & vbTab _
		          & ChassisType.Value    & vbTab _
		          & MBManufacturer.Value & vbTab _
		          & MBModel.Value        & vbTab _
		          & MBVersion.Value
	End If

	CheckboxMainBoard.Disabled = True
End Sub


Sub InventoryMemory( gvsComputer )
	Dim colItems, objItem

	If CheckboxMemory.Checked Then
		On Error Resume Next

		' Capacity filter intended for HP/COMPAQ EVO models
		Set colItems = gvoWMIService.ExecQuery( "SELECT Capacity,Speed FROM Win32_PhysicalMemory WHERE Capacity > 524288" )
		If Not Err Then
			For Each objItem in colItems
				gvcMemory = gvcMemory + 1
				gviMemSize = gviMemSize + objItem.Capacity
				If gviMemSpeed = 0 Or objItem.Speed < gviMemSpeed Then gviMemSpeed = objItem.Speed
			Next
			MemoryModules.Value = gvcMemory
			MemorySize.Value    = Round( gviMemSize / 1048576 )
	
			Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_PhysicalMemoryArray" )
			For Each objItem In colItems
				If objItem.MemoryDevices > gvcBanks Then gvcBanks = objItem.MemoryDevices
			Next
		End If

		On Error Goto 0

		MemoryBanks.Value = gvcBanks

		ButtonDetailsMemory.Disabled = False

		gvsHeader = gvsHeader            & vbTab _
		          & "# Memory Banks:"    & vbTab _
	              & "# Memeory Modules:" & vbTab _
	              & "Total Memory (MB):"
	    gvsCSVTxt = gvsCSVTxt            & vbTab _
		          & gvcBanks             & vbTab _
		          & gvcMemory            & vbTab _
		          & MemorySize.Value
	End If
End Sub


Sub InventoryMonitor( gvsComputer )
	Dim arrKeys, arrMfg, arrSubKeys, arrSubSubKeys
	Dim blnControl
	Dim i, idxMonI, idxMonJ, intSize, intHeight, intWidth, numRatio
	Dim colItems, objItem, objReg, objWMIService
	Dim strDeviceDesc, strMfg, strKeyPath, strPnPDeviceID, strQuery
	Dim strSubKeyPath, strSubSubKey, strSubSubKeyPath

	If CheckboxMonitor.Checked Then
		On Error Resume Next

		Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//" & gvsComputer & "/root/default:StdRegProv" )
		If Err Then Exit Sub

		strKeyPath = "SYSTEM\CurrentControlSet\Enum\DISPLAY"
		objReg.EnumKey  HKEY_LOCAL_MACHINE, strKeyPath, arrKeys
		If Not IsArray( arrKeys ) Then Exit Sub

		For idxMonI = 0 To UBound( arrKeys )
			If InStr( 1, arrKeys( idxMonI ), "default", vbTextCompare ) < 1 Then
				strSubKeyPath = strKeyPath & "\" & arrKeys( idxMonI )
				objReg.EnumKey HKEY_LOCAL_MACHINE, strSubKeyPath, arrSubKeys
				If IsArray( arrSubKeys ) Then
					For idxMonJ = 0 To UBound( arrSubKeys )
						strSubSubKeyPath = strSubKeyPath & "\" & arrSubKeys( idxMonJ )
						objReg.EnumKey HKEY_LOCAL_MACHINE, strSubSubKeyPath, arrSubSubKeys
						blnControl = False
						If IsArray( arrSubSubKeys ) Then
							For Each strSubSubKey In arrSubSubKeys
								If strSubSubKey = "Control" Then blnControl = True
							Next
						End If
						If blnControl Then
							strPnPDeviceID = Replace( strSubSubKeyPath, strKeyPath, "DISPLAY" )
							objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubSubKeyPath, "Mfg", strMfg
							If Not IsNull( strMfg ) Then
								If Left( strMfg, 1 ) <> "(" Then
									arrMfg = Split( strMfg, ";" )
									If IsArray( arrMfg ) Then
										i = UBound( arrMfg )
										strMfg = arrMfg(i)
									End If
								End If
								objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubSubKeyPath, "DeviceDesc", strDeviceDesc
								objReg.GetBinaryValue HKEY_LOCAL_MACHINE, strSubSubKeyPath & "\Device Parameters", "EDID", gvaRawEDID
								If IsArray( gvaRawEDID ) Then
									EDIDTest 54
									EDIDTest 72
									EDIDTest 90
									EDIDTest 108
								End If

								If gvsMonitorModel = "" Then gvsMonitorModel  = strDeviceDesc
								If gvbTest              Then gvsMonitorSerial = "0123456789"

								strQuery = "SELECT * FROM WmiMonitorBasicDisplayParams WHERE InstanceName LIKE '" & Replace( strPnPDeviceID, "\", "\\" ) & "_%'"
								Set objWMIService = GetObject( "winmgmts://" & gvscomputer & "/root/WMI" )
								Set colItems = objWMIService.ExecQuery( strQuery )
								If Not Err Then
									If colItems.Count = 1 Then
										For Each objItem in colItems
											intHeight   = objItem.MaxVerticalImageSize
											intWidth    = objitem.MaxHorizontalImageSize
											If intHeight * intWidth > 0 Then
												numRatio = intWidth / intHeight
												If gvbDisplaySizeInCm Then
													MonitorModelCaption.innerHTML = "Model (and size):"
													gvsMonitorModel = gvsMonitorModel & " (" & intWidth  & " x " & intHeight & " cm"
												Else
													MonitorModelCaption.innerHTML = "Model (and diagonal size):"
													intSize = CInt( Sqr( ( intWidth * intWidth ) + ( intHeight * intHeight ) ) / 2.54 )
													gvsMonitorModel = gvsMonitorModel & " (" & intSize & """"
												End If
												' Display if widescreen or not
												If numRatio >= 1.45 Then
													gvsMonitorModel = gvsMonitorModel & " widescreen)"
												Else
													gvsMonitorModel = gvsMonitorModel & ")"
												End If
											End If
										Next
									End If
								End If
								Set objWMIService = Nothing

								Select Case gvcMonitor
									Case 0
										MonitorIndex0.Value        = gvcMonitor
										MonitorModel0.Value        = gvsMonitorModel
										MonitorManufacturer0.Value = strMfg
										MonitorSerial0.Value       = gvsMonitorSerial
									Case 1
										MultipleMonitors.style.display = "inline"
										Monitor1.style.display     = gvsTableRowStyle
										MonitorIndex1.Value        = gvcMonitor
										MonitorModel1.Value        = gvsMonitorModel
										MonitorManufacturer1.Value = strMfg
										MonitorSerial1.Value       = gvsMonitorSerial
									Case 2
										Monitor2.style.display     = gvsTableRowStyle
										MonitorIndex2.Value        = gvcMonitor
										MonitorModel2.Value        = gvsMonitorModel
										MonitorManufacturer2.Value = strMfg
										MonitorSerial2.Value       = gvsMonitorSerial
									Case 3
										Monitor3.style.display     = gvsTableRowStyle
										MonitorIndex3.Value        = gvcMonitor
										MonitorModel3.Value        = gvsMonitorModel
										MonitorManufacturer3.Value = strMfg
										MonitorSerial3.Value       = gvsMonitorSerial
									Case Else
										If Not Right( MonitorIndex3.Value, 1 ) = "*" Then
											MonitorIndex3.Value = MonitorIndex3.Value & "*"
										End If
								End Select
								gvcMonitor = gvcMonitor + 1
							End If
						End If
					Next
				End If
			End If
		Next

		On Error Goto 0

		ButtonDetailsMonitor.Disabled = False

		gvsHeader = gvsHeader & vbTab _
		          & "Monitor 0 Model:"          & vbTab _
		          & "Monitor 0 Manufacturer:"   & vbTab _
		          & "Monitor 0 Serial:"         & vbTab _
		          & "Monitor 1 Model:"          & vbTab _
		          & "Monitor 1 Manufacturer:"   & vbTab _
		          & "Monitor 1 Serial:"         & vbTab _
		          & "Monitor 2 Model:"          & vbTab _
		          & "Monitor 2 Manufacturer:"   & vbTab _
		          & "Monitor 2 Serial:"         & vbTab _
		          & "Monitor 3 Model:"          & vbTab _
		          & "Monitor 3 Manufacturer:"   & vbTab _
		          & "Monitor 3 Serial:"
		gvsCSVTxt = gvsCSVTxt                   & vbTab _
		          & MonitorModel0.Value         & vbTab _
		          & MonitorManufacturer0.Value  & vbTab _
		          & MonitorSerial0.Value        & vbTab _
		          & MonitorModel1.Value         & vbTab _
		          & MonitorManufacturer1.Value  & vbTab _
		          & MonitorSerial1.Value        & vbTab _
		          & MonitorModel2.Value         & vbTab _
		          & MonitorManufacturer2.Value  & vbTab _
		          & MonitorSerial2.Value        & vbTab _
		          & MonitorModel3.Value         & vbTab _
		          & MonitorManufacturer3.Value  & vbTab _
		          & MonitorSerial3.Value
	End If
End Sub


Sub InventoryNIC( gvsComputer )
	Dim colItems, objItem
	Dim strMACAddress, strQuery
	
	If CheckBoxNIC.Checked Then
		On Error Resume Next

		strQuery = "SELECT * FROM Win32_NetworkAdapter WHERE NOT Manufacturer='Microsoft' AND AdapterType LIKE 'Ethernet%' AND AdapterTypeId=0 AND NOT ProductName LIKE '%mini%po%rt%' AND NOT MACAddress='' AND MACAddress IS NOT NULL"
		If gviNumOS < 6 Then
			Set colItems = gvoWMIService.ExecQuery( strQuery )
		Else
			Set colItems = gvoWMIService.ExecQuery( strQuery & " AND PhysicalAdapter='TRUE'" )
		End If
		' Check if any instance was returned, if not, widen the search criteria by skipping PhysicalAdapter requirement
		If Err Or colItems.Count = 0 Then
			strQuery = "SELECT * FROM Win32_NetworkAdapter WHERE NOT ProductName LIKE '%mini%po%rt%' AND NOT MACAddress='' AND MACAddress IS NOT NULL"
			Err.Clear
			Set colItems = gvoWMIService.ExecQuery( strQuery )
		End If
		If Not Err Then
			For Each objItem In colItems
				strMACAddress = Join( Split( objItem.MACAddress, ":", -1, vbTextCompare ), "" )
				If gvbTest Then strMACAddress = "0123456789ABCDEF"
				Select Case gvcNIC
					Case 0
						MACAddress0.Value = strMACAddress
						NICIndex0.Value   = gvcNIC
						NICModel0.Value   = objItem.ProductName
						NICSpeed0.Value   = InventoryNICSpeed( objItem.ProductName )
						ButtonDetailsNIC.Disabled = False
					Case 1
						MultipleNICs.style.display = "inline"
						NIC1.style.display = gvsTableRowStyle
						MACAddress1.Value  = strMACAddress
						NICIndex1.Value    = gvcNIC
						NICModel1.Value    = objItem.ProductName
						NICSpeed1.Value    = InventoryNICSpeed( objItem.ProductName )
					Case 2
						NIC2.style.display = gvsTableRowStyle
						MACAddress2.Value  = strMACAddress
						NICIndex2.Value    = gvcNIC
						NICModel2.Value    = objItem.ProductName
						NICSpeed2.Value    = InventoryNICSpeed( objItem.ProductName )
					Case 3
						NIC3.style.display = gvsTableRowStyle
						MACAddress3.Value  = strMACAddress
						NICIndex3.Value    = gvcNIC
						NICModel3.Value    = objItem.ProductName
						NICSpeed3.Value    = InventoryNICSpeed( objItem.ProductName )
					Case Else
						If Not Right( NICIndex3.Value, 1 ) = "*" Then
							NICIndex3.Value = NICIndex3.Value & "*"
						End If
				End Select
				gvcNIC = gvcNIC + 1
			Next
		End If

		On Error Goto 0

		gvsHeader = gvsHeader            & vbTab _
		          & "NIC 0 Model:"       & vbTab _
		          & "NIC 0 MAC Address:" & vbTab _
		          & "NIC 0 Speed:"       & vbTab _
		          & "NIC 1 Model:"       & vbTab _
		          & "NIC 1 MAC Address:" & vbTab _
		          & "NIC 1 Speed:"       & vbTab _
		          & "NIC 2 Model:"       & vbTab _
		          & "NIC 2 MAC Address:" & vbTab _
		          & "NIC 2 Speed:"       & vbTab _
		          & "NIC 3 Model:"       & vbTab _
		          & "NIC 3 MAC Address:" & vbTab _
		          & "NIC 3 Speed:"
		gvsCSVTxt = gvsCSVTxt            & vbTab _
		          & NICModel0.Value      & vbTab _
		          & MACAddress0.Value    & vbTab _
		          & NICSpeed0.Value      & vbTab _
		          & NICModel1.Value      & vbTab _
		          & MACAddress1.Value    & vbTab _
		          & NICSpeed1.Value      & vbTab _
		          & NICModel2.Value      & vbTab _
		          & MACAddress2.Value    & vbTab _
		          & NICSpeed2.Value      & vbTab _
		          & NICModel3.Value      & vbTab _
		          & MACAddress3.Value    & vbTab _
		          & NICSpeed3.Value

		ButtonDetailsNIC.Disabled = False
	End If
End Sub


Function InventoryNICSpeed( strInstance )
	Dim colItems, objItem, objWMIService, strNICSpeed

	strNICSpeed = ""

	On Error Resume Next
	Set objWMIService = GetObject( "winmgmts://" & gvsComputer & "/root/WMI"   )
	Set colItems = objWMIService.ExecQuery( "SELECT NdisLinkSpeed FROM MSNdis_LinkSpeed WHERE InstanceName = '" & strInstance & "' AND Active = True" )
	If Not Err Then
		For Each objItem In colItems
			If objItem.NdisLinkSpeed < 10000 Then
				strNICSpeed = objItem.NdisLinkSpeed /    10 & " kb/s"
			Else
				strNICSpeed = objItem.NdisLinkSpeed / 10000 & " Mb/s"
			End If
		Next
	End If
	On Error Goto 0

	InventoryNICSpeed = strNICSpeed
End Function


Sub InventoryPorts( gvsComputer )
	Dim cntAGP, cntOth, cntPar, cntPCI, cntPCIE, cntSer, cntUSB, cntUSB3, colItems, objItem, strSlots

	cntAGP  = 0
	cntOth  = 0
	cntPar  = 0
	cntPCI  = 0
	cntPCIE = 0
	cntSer  = 0
	cntUSB  = 0
	cntUSB3 = 0
	

	If CheckBoxPorts.Checked Then
		On Error Resume Next

		' Check for USB controllers
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_USBController" )
		If Not Err Then cntUSB = colItems.Count
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_USBController WHERE Name LIKE '%USB 3%'" )
		If Not Err Then
			cntUSB3 = colItems.Count
			cntUSB  = cntUSB - cntUSB3
		End If
		If cntUSB3 > 0 Then
			USB.Value = cntUSB & " + " & cntUSB3 & " x USB3"
		Else
			USB.Value = cntUSB
		End If

		' Count parallel ports
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_ParallelPort" )
		If Not Err Then cntPar = colItems.Count
		Parallel.Value = cntPar

		' Count serial ports
		Set colItems = gvoWMIService.ExecQuery( "SELECT * FROM Win32_SerialPort" )
		If Not Err Then cntSer = colItems.Count
		Serial.Value = cntSer

		' Count system slots (PCI/AGP)
		Set colItems = gvoWMIService.ExecQuery( "SELECT SlotDesignation FROM Win32_SystemSlot" )
		If Not Err Then
			For Each objItem In colItems
				If Left( objItem.SlotDesignation, 3 ) = "AGP" Then cntAGP = cntAGP + 1
				If Left( objItem.SlotDesignation, 3 ) = "PCI" Then
					If Left( objItem.SlotDesignation, 4 ) = "PCIE" Then
						cntPCIE = cntPCIE + 1
					Else
						cntPCI = cntPCI + 1
					End If
				End If
				If InStr( "AGPCI", Left( objItem.SlotDesignation, 3 ) ) = 0 Then cntOth = cntOth + 1
			Next
		End If

		On Error Goto 0

		Slots.Value = cntPCI & " x PCI, " & cntPCIE & " x PCIE, " & cntAGP & " x AGP"
		strSlots    = cntPCI &   "xPCI "  & cntPCIE &   "xPCIE "  & cntAGP &   "xAGP"
		If cntOth > 0 Then
			Slots.Value = Slots.Value & ", " & cntOth & " x Other"
			strSlots    = strSlots    & " "  & cntOth &   "xOther"
		End If

		gvsHeader = gvsHeader         & vbTab _
		          & "USB:"            & vbTab _
		          & "System Slots:"   & vbTab _
		          & "Parallel Ports:" & vbTab _
		          & "Serial Ports:"
		gvsCSVTxt = gvsCSVTxt         & vbTab _
		          & USB.Value         & vbTab _
		          & strSlots          & vbTab _
		          & Parallel.Value    & vbTab _
		          & Serial.Value

		ButtonDetailsPorts.Disabled = False
	End If
End Sub


Sub InventorySound( gvsComputer )
	Dim colItems, objItem

	If CheckBoxSound.Checked Then
		On Error Resume Next

		Set colItems = gvoWMIService.ExecQuery( "SELECT Manufacturer,ProductName FROM Win32_SoundDevice" )
		If Not Err Then
			For Each objItem In colItems
				SoundCardManufacturer.Value = objItem.Manufacturer
				SoundCardModel.Value        = objItem.ProductName
			Next
		End If

		On Error Goto 0

		ButtonDetailsSound.Disabled = False

		gvsHeader = gvsHeader                   & vbTab _
		          & "Sound Card Model:"         & vbTab _
		          & "Sound Card Manufacturer:"
		gvsCSVTxt = gvsCSVTxt                   & vbTab _
		          & SoundCardManufacturer.Value & vbTab _
		          & SoundCardModel.Value
	End If
End Sub


Sub InventoryVideo( gvsComputer )
	Dim colItems, objItem

	If CheckboxVideo.Checked Then
		On Error Resume Next

		Set colItems = gvoWMIService.ExecQuery( "Select AdapterRAM,Name,VideoModeDescription from Win32_VideoController" )
		If Not Err Then
			For Each objItem in colItems
				Select Case gvcVideo
					Case 0
						VideoIndex0.Value    = gvcVideo
						VideoModel0.Value    = objItem.Name
						VideoMemory0.Value   = Round( objItem.AdapterRAM / 1048576 )
						VideoMode0.Value     = objItem.VideoModeDescription
						ButtonDetailsVideo.Disabled = False
					Case 1
						Video1.style.display = gvsTableRowStyle
						VideoIndex1.Value    = gvcVideo
						VideoModel1.Value    = objItem.Name
						VideoMemory1.Value   = Round( objItem.AdapterRAM / 1048576 )
						VideoMode1.Value     = objItem.VideoModeDescription
					Case 2
						Video2.style.display = gvsTableRowStyle
						VideoIndex2.Value    = gvcVideo
						VideoModel2.Value    = objItem.Name
						VideoMemory2.Value   = Round( objItem.AdapterRAM / 1048576 )
						VideoMode2.Value     = objItem.VideoModeDescription
					Case 3
						Video3.style.display = gvsTableRowStyle
						VideoIndex3.Value    = gvcVideo
						VideoModel3.Value    = objItem.Name
						VideoMemory3.Value   = Round( objItem.AdapterRAM / 1048576 )
						VideoMode3.Value     = objItem.VideoModeDescription
				End Select
				gvcVideo = gvcVideo + 1
			Next
	
			If gvcVideo > 4 Then
				VideoIndex3.Value = VideoIndex3.Value & "*"
			End If
		End If

		On Error Goto 0
	End If
End Sub


Function Max( num1, num2 )
	If num1 > num2 Then
		Max = num1
	Else
		Max = num2
	End If
End Function


Function Min( num1, num2 )
	If num1 < num2 Then
		Min = num1
	Else
		Min = num2
	End If
End Function


Sub PasteFromClipboard
	Dim strText
	On Error Resume Next
	strText = Document.ParentWindow.ClipboardData.GetData( "text" )
	If Err Then
		MsgBox "An error occurred while trying to paste data from the clipboard:" & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Clipboard Error"
	Else
		If Not IsNull( strText ) Then ComputerName.Value = strText
	End If
	On Error Goto 0
End Sub


Sub Print( blnPrintToDefault )
	' Build an HTML table with the results, to allow printing
	Dim arrData, arrHeader
	Dim i, j
	Dim strTable

	Const OLECMDID_PRINT               =  6
	Const OLECMDID_PRINT2              = 49
	Const OLECMDID_PRINTPREVIEW        =  7
	Const OLECMDID_PRINTPREVIEW2       = 50
	Const OLECMDEXECOPT_DODEFAULT      =  0
	Const OLECMDEXECOPT_PROMPTUSER     =  1
	Const OLECMDEXECOPT_DONTPROMPTUSER =  2
	Const OLECMDEXECOPT_SHOWHELP       =  3 

	' Even though we aren't going to display the HTML page, linefeeds and whitespace are added as IE9 seems to be rather sensitive to it
	strTable  = "<table style=""border: 1px solid black; width: 100%;"">" & vbCrLf
	strTable  = strTable  & "<thead style=""font-weight: bold; font-size: 120%; display: table-header-group; page-break-before: always;"">" & vbCrLf
	strTable  = strTable  & "<tr style=""page-break-inside: avoid;"">" & vbCrLf
	strTable  = strTable  & "    <th style=""page-break-inside: avoid; border: 1px solid black;"">Component</th>" & vbCrLf
	strTable  = strTable  & "    <th style=""page-break-inside: avoid; border: 1px solid black;"">Value</th>" & vbCrLf
	strTable  = strTable  & "</tr>" & vbCrLf
	strTable  = strTable  & "</thead>" & vbCrLf
	strTable  = strTable  & "<tbody>" & vbCrLf
	arrData   = Split( gvsCSVTxt, vbTab )
	arrHeader = Split( gvsHeader, vbTab )
	For i = 0 To Max( UBound( arrHeader ), UBound( arrData ) )
		If Trim( arrData(i) ) <> "" Then
			strTable = strTable & "<tr style=""page-break-inside: avoid;"">" & vbCrLf
			strTable = strTable & "    <th style=""page-break-inside: avoid; border: 1px solid black; text-align: left; padding: 5px;"">" & arrHeader(i) & "</th>" & vbCrLf
			strTable = strTable & "    <td style=""page-break-inside: avoid; border: 1px solid black; padding: 5px;"">" & arrData(i) & "</td>" & vbCrLf
			strTable = strTable & "</tr>" & vbCrLf
		End If
	Next
	strTable = strTable & "</tbody>" & vbCrLf
	strTable = strTable & "</table>" & vbCrLf

	On Error Resume Next
	CreateIEPrint
	While gvoIEPrint.Busy
		Sleep 1
	Wend
	gvoIEPrint.Navigate "about:blank"
	On Error Goto 0

	gvoIEPrint.Document.Title = "Basic Hardware Inventory " & HardwInv.Version & " - &copy; 2005 - 2012 Rob van der Woude"
	gvoIEPrint.Document.Body.style.fontFamily = "arial,sans-serif"
	gvoIEPrint.Document.Body.innerHTML = strTable
	gvoIEPrint.Visible = True
	If blnPrintToDefault Then
		' Print to default printer without user interaction
		gvoIEPrint.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
		' Give IE some time to send the command to the printer
		Sleep 5
	Else
		' Show Print Preview
		gvoIEPrint.ExecWB OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER
	End If
	gvoIEPrint.Visible = False
	While gvoIEPrint.Busy
		Sleep 1
	Wend
	If Not Err Then CreateIEPrint
End Sub


Sub PrintPreview( )
	Print False
End Sub


Sub PrintToDefault( )
	Print True
End Sub


Sub Reset( )
	Window_OnUnload
	Location.Reload( True )
End Sub


Function SaveFile( )
	Dim objFile, strFile, strMsg
	If gvsCSVTxtFile = "*" Then
		strFile = Trim( InputBox( "Enter the target file name:", "Save Basic Hardware Inventory results" ) )
	Else
		strFile = gvsCSVTxtFile
	End If
	If strFile <> "" Then
		If Left( strFile, 1 )  = """" Then strFile = Mid( strFile, 2 )
		If Right( strFile, 1 ) = """" Then strFile = Left( strFile, Len( strFile ) - 1 )
	End If
	With gvoFSO
		If .FolderExists( .GetParentFolderName( strFile ) ) Then
			On Error Resume Next
			strFile = .GetAbsolutePathName( strFile )
			Set objFile = .CreateTextFile( strFile, True, False )
			If Err Then
				strMsg = "Error #" & Err.Number & " while trying to save the results to """ & strFile & """:"
				strMsg = strMsg & vbCrLf & Err.Description
				MsgBox strMsg, vbOKOnly, "File save error"
				strFile = ""
			Else
				objFile.WriteLine gvsHeader
				objFile.WriteLine gvsCSVTxt
				objFile.Close
			End If
			Set objFile = Nothing
			On Error Goto 0
		Else
			MsgBox "Folder """ & .GetParentFolderName( strFile ) & """ dîs not exist.", vbOKOnly, "File save error"
			strFile = ""
		End If
	End With
	SaveFile = strFile
End Function


Sub Sleep( seconds )
	Dim objShell, strCmd
	On Error Resume Next
	Set objShell = CreateObject( "Wscript.Shell" )
	strCmd = "%COMSPEC% /C PING -n " & seconds & " 127.0.0.1 > NUL 2>&1"
	objShell.Run strCmd, 0, 1
	Set objShell = Nothing
	On Error Goto 0
End Sub


Function TextFromHTML( URL )
	' Basic routine borrowed from http://dev.remotenetworktechnology.com/wsh/rubegoldberg.htm
	' Improved wait-until-ready routine for HTAs by McKirahan on
	' http://support.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.scripting.scriptlets&tid=be461ec2-b444-440c-8155-ad0e8e839ca6&lang=en&cr=US&sloc=en-us&p=1
	Dim objIE

	TextFromHTML = ""

	On Error Resume Next

	Set objIE = CreateObject( "InternetExplorer.Application" )
 	objIE.Navigate URL
 	If Err Then
		TextFromHTML = ""
 	Else
		While objIE.Busy
			Sleep 1
		Wend
		TextFromHTML = Trim( objIE.Document.Body.InnerText )
	End If
	objIE.Quit
	Set objIE = Nothing
	
	On Error Goto 0
End Function


Function UnTag( strString )
	' This function replaces special characters by their "ampersand code".
	' The lines strPre = "" etc. are there to make sure that strPre has
	' a value even if the next line fails.
	Dim posAmp, posGt, posLt, posPost, posPre

	On Error Resume Next

	If InStr( strString, "&" ) > 0 Then
		posAmp = -1
		Do Until posAmp = 0
			posAmp    = InStr( posAmp + 2, strString, "&" )
			strPre    = ""
			strPre    = Mid( strString, 1, posAmp - 1 )
			strPost   = ""
			strPost   = Mid( strString, posAmp + 1 )
			If posAmp > 0 Then strString = strPre & "&amp;" & strPost
		Loop
	End If

	If InStr( strString, "<" ) > 0 Then
		posLt = -1
		Do Until posLt = 0
			posLt     = InStr( posLt + 2, strString, "<" )
			strPre    = ""
			strPre    = Mid( strString, 1, posLt - 1 )
			strPost   = ""
			strPost   = Mid( strString, posLt + 1 )
			If posLt > 0 Then strString = strPre & "&lt;" & strPost
		Loop
	End If

	If InStr( strString, ">" ) > 0 Then
		posGt = -1
		Do Until posGt = 0
			posGt     = InStr( posGt + 2, strString, ">" )
			strPre    = ""
			strPre    = Mid( strString, 1, posGt - 1 )
			strPost   = ""
			strPost   = Mid( strString, posGt + 1 )
			If posGt > 0 Then strString = strPre & "&gt;" & strPost
		Loop
	End If

	On Error Goto 0

	UnTag = strString
End Function


Sub Window_Onload
	Dim objINI, strLine, strFile

	' Initialize global variables
	Initialize

	' Check if a file HARDWARE.CFG exists, and if so,
	' read the command line defaults from HARDWARE.CFG
	If gvoFSO.FileExists( gvsHTAPath & "Hardware.cfg" ) Then
		Set objINI = gvoFSO.OpenTextFile( gvsHTAPath & "Hardware.cfg" )
		' Use custom error handling, as a 0 byte config file might cause trouble
		On Error Resume Next
		strLine = objINI.ReadLine( )
		If Not Err Then
			If Trim( strLine ) <> "" Then
				gvsCmdLine = gvsCmdLine & " " & UCase( Trim( strLine ) )
			End If
		End If
		On Error Goto 0
	End If

	AppVersion.InnerHTML = HardwInv.Version
	document.title = "Basic Hardware Inventory (Version " & HardwInv.Version & ") © Rob van der Woude 2005 - 2012"
	ButtonCopy.Disabled  = True
	ButtonPaste.Disabled = False
	ButtonPrint.Disabled = True
	ButtonRun.Disabled   = False
	ButtonReset.Disabled = True
	ButtonSave.Disabled  = True
	If InStr( gvsCmdLine, "/BASIC" ) Then
		gvbFullInventory  = False
		ButtonBasic.Value = "Full"
	End If
	CheckboxBIOS.Checked            = gvbFullInventory
	CheckboxCDROM.Checked           = gvbFullInventory
	CheckboxCPU.Checked             = True
	CheckboxHDD.Checked             = True
	CheckboxMainBoard.Checked       = gvbFullInventory
	CheckboxMemory.Checked          = True
	CheckboxMonitor.Checked         = gvbFullInventory
	CheckboxNIC.Checked             = gvbFullInventory
	CheckboxPorts.Checked           = gvbFullInventory
	CheckboxVideo.Checked           = gvbFullInventory
	CheckboxSound.Checked           = gvbFullInventory
	ButtonDetailsBIOS.Disabled      = True
	ButtonDetailsCPU.disabled       = True
	ButtonDetailsHDD.disabled       = True
	ButtonDetailsCDROMOM.Disabled   = True
	ButtonDetailsMainBoard.disabled = True
	ButtonDetailsMemory.Disabled    = True
	ButtonDetailsMonitor.Disabled   = True
	ButtonDetailsNIC.disabled       = True
	ButtonDetailsPorts.disabled     = True
	ButtonDetailsSound.Disabled     = True
	ButtonDetailsVideo.Disabled     = True

	CreateIEHelp
	gvoIEHelp.Visible = 0
	If InStr( gvsCmdLine, "?" ) Or InStr( gvsCmdLine, "HELP" ) Then HelpMsg
	If InStr( gvsCmdLine, "/CM" ) Then gvbDisplaySizeInCm = True
	If InStr( gvsCmdLine, "/COMPUTER:" ) Then
		gvsComputer = Mid( gvsCmdLine, InStr( gvsCmdLine, "/COMPUTER:" ) + 10 )
		If InStr( gvsComputer, " " ) Then gvsComputer = Left( gvsComputer, InStr( gvsComputer, " " ) - 1 )
		gvsComputer = Trim( Replace( gvsComputer, """", "" ) )
		If gvsComputer = "" Then gvsComputer = GetComputerName( )
		ComputerName.Value = gvsComputer
	End If
	If InStr( gvsCmdLine, "/DXDIAG" ) Then
		If gvsComputer = "" Or gvsComputer = GetComputerName( ) Then
			gvbUseDxDiag = True
		End If
	End If
	If InStr( gvsCmdLine, "/SAVE:" ) Then
		gvsCSVTxtFile = Mid( gvsCmdLine, InStr( gvsCmdLine, "/SAVE:" ) + 6 )
		If InStr( gvsCSVTxtFile, " " ) Then gvsCSVTxtFile = Left( gvsCSVTxtFile, InStr( gvsCSVTxtFile, " " ) - 1 )
		gvsCSVTxtFile = Trim( Replace( gvsCSVTxtFile, """", "" ) )
		If gvsCSVTxtFile = "" Then gvsCSVTxtFile = "Hardware.csv"
	End If
	If InStr( gvsCmdLine, "/XML:" ) Then
		gvsXML = Mid( gvsCmdLine, InStr( gvsCmdLine, "/XML:" ) + 5 )
		If InStr( gvsXML, " " ) Then gvsXML = Left( gvsXML, InStr( gvsXML, " " ) - 1 )
		gvsXML = Trim( Replace( gvsXML, """", "" ) )
		If gvsXML = "" Then gvsXML = "Hardware.xml"
	End If
	If InStr( gvsCmdLine, "/TEST"     ) Then gvbTest      = True
	If InStr( gvsCmdLine, "/USBSTOR"  ) Then gvbUSBSTOR   = True
	If InStr( gvsCmdLine, "/KEEPXML"  ) Then gvbKeepXML   = True
	If InStr( gvsCmdLine, "/SIZE:"    ) Then WxH InStr( gvsCmdLine, "/SIZE:" ) + 5
	If InStr( gvsCmdLine, "/NOUPDCHK" ) Then
		gvbUpdateCheck       = False
		UpdateBlock.style.display = "none"
	End If
	CheckUpdate
	window.offscreenBuffering = True

	ComputerName.Focus( )

	' Tweak for Internet Explorer 7 and older versions
	gvbIE7 = IE7( )
	If gvbIE7 Then gvsTableRowStyle = "inline"

	If InStr( gvsCmdLine, "/COPY" ) Or InStr( gvsCmdLine, "/PRINT" ) Or InStr( gvsCmdLine, "/SAVE" ) Or InStr( gvsCmdLine, "/COMPUTER:" ) Then
		Inventory
		If InStr( gvsCmdLine, "/COPY"  ) Then CopyToClipboard
		If InStr( gvsCmdLine, "/PRINT" ) Then PrintToDefault
		If InStr( gvsCmdLine, "/SAVE"  ) Then strFile = SaveFile( )
		If InStr( gvsCmdLine, "/COPY"  ) And Not InStr( gvsCmdLine, "/SAVE" )  Then
			window.close( )
		End If
		If InStr( gvsCmdLine, "/PRINT" ) And Not InStr( gvsCmdLine, "/SAVE" )  Then
			window.close( )
		End If
		If InStr( gvsCmdLine, "/SAVE" ) And strFile <> "" Then
			window.close( )
		End If
	End If
End Sub


Sub Window_OnUnload
	On Error Resume Next
	' Delete DxDiag's XML file if it exists, unless /KEEPXML switch was used
	If gvbUseDxDiag Then
		If Not gvbKeepXML Then
			If Trim( gvsXML ) <> "" Then
				If gvoFSO.FileExists( gvsXML ) Then
					gvoFSO.DeleteFile gvsXML, True
				End If
			End If
		End If
	End If
	' Close the Internet Explorer instances
	If IsObject( gvoIECredits ) Then
		gvoIECredits.Quit
		Set gvoIECredits = Nothing
	End If
	If IsObject( gvoIEHelp ) Then
		gvoIEHelp.Quit
		Set gvoIEHelp = Nothing
	End If
	If IsObject( gvoIEPrint ) Then
		gvoIEPrint.Quit
		Set gvoIEPrint = Nothing
	End If
	' Close object instances
	Set gvoWMIService = Nothing
	Set gvoFSO        = Nothing
	On Error Goto 0
End Sub


Sub WindowSize( iWidth, iHeight )
	On Error Resume Next
	Dim posWidth, posHeight
	posWidth  = Max( 0, Int( ( window.screen.width  - iWidth  ) / 2 ) )
	posHeight = Max( 0, Int( ( window.screen.height - iHeight ) / 2 ) )
	window.resizeTo iWidth, iHeight
	window.moveTo posWidth, posHeight
	On Error GoTo 0
End Sub


Sub WxH( posColon )
	Dim myHeight, myWidth, posSpace, posX
	Dim strWxH

	Const minHeight = 600
	Const minWidth  = 800

	strWxH = Mid( gvsCmdLine, posColon + 1 )
	posSpace = InStr( strWxH, " " )
	If posSpace > 0 Then
		strWxH = Left( strWxH, posSpace - 1 )
	End If
	posX = InStr( strWxH, "X" )
	If posX > 0 Then
		gviReqWidth = Int( Left( strWxH, posX - 1 ) )
		gviReqHeight = Int( Mid( strWxH, posX + 1 ) )
		If IsNumeric( gviReqHeight ) And IsNumeric( gviReqWidth ) Then
			gviReqHeight = Max( gviReqHeight, minHeight )
			gviReqWidth  = Max( gviReqWidth,  minWidth )
			gviReqHeight = Min( gviReqHeight, Int( window.screen.height ) )
			gviReqWidth  = Min( gviReqWidth,  Int( window.screen.width  ) )
			WindowSize gviReqWidth, gviReqHeight
		End If
	End If
End Sub
</script>

<body style="font:12 pt arial; color:white; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#0000FF', EndColorStr='#000000')" onhelp="HelpMsg()">

<div align="center">

<div id="UpdateBlock" style="margin: 10px auto 10px auto; width: 750px; padding: 10px; display: none;">

<h3>Update</h3>

<table>
<tr>
	<td id="UpdateNotification" colspan="5">&nbsp;</td>
</tr>
<tr>
	<td colspan="5">&nbsp;</td>
</tr>
<tr>
	<td style="width: 20%;">&nbsp;</td>
	<td style="width: 20%;"><input type="button" class="Button" value="Download" onclick="Download"               title="Click this button to open this HTA's download page."></td>
	<td style="width: 20%;">&nbsp;</td>
	<td style="width: 20%;"><input type="button" class="Button" value="Hide"     onclick="HideUpdateNotification" title="Click this button to hide this update notification."></td>
	<td style="width: 20%;">&nbsp;</td>
</tr>
</table>

</div>



<table border="0" cellpadding="0" cellspacing="10">
<tr>
    <td><input id="ButtonPaste" class="Button" type="button" value="Paste" name="ButtonPaste" onclick="PasteFromClipboard" title="Click here to paste a remote computer name from the clipboard into the Computer Name field. Then click the [Go] button to start the inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><B>Computer:</B></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="ComputerName" size="20" title="Paste or type a remote computer name, or leave this field blank to query the local computer. Then click the [Go] button to start the inventory." onkeypress="CheckForEnterKey"></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonBasic" class="Button" type="button" value="Basic" name="ButtonBasic" onclick="Basic"     title="Click this button to toggle between Basic and Full Inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonRun"   class="Button" type="button" value="Go"    name="ButtonRun"   onclick="Inventory" title="Click here to start the inventory"></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonReset" class="Button" type="button" value="Reset" name="ButtonReset" onclick="Reset"     title="Click here to clear all fields"></td>
</tr>
</table>

<table id="Results" border="0" cellpadding="0" cellspacing="0" align="center">
<thead>
<tr>
    <td colspan="13">&nbsp;</td>
</tr>
</thead>
<tbody>
<tr id="CPUHeader">
    <td colspan="4">&nbsp;</td>
    <td>Number:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Speed (MHz):</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Socket:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="CPURow">
    <td><input type="checkbox" id="CheckboxCPU" name="CheckboxCPU" checked=True title="Deselect this checkbox if you want to exclude the processor(s) from the inventory."></td>
    <td><label for="CheckboxCPU">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxCPU">CPU<span id="MultipleCPUs" style="display: none;">s</span>:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CPUNumber" size="10" readonly title="This read-only field will display the number of (logical) processors found. For processors with hyperthreading the displayed number will be twice the number of physical processors."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CPUModel"  size="40" readonly title="This read-only field will display the processor type."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CPUSpeed"  size="16" readonly title="This read-only field will display the processor clock speed in MHz."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CPUSocket" size="16" readonly title="This read-only field will display the processor socket type."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsCPU" class="Button" type="button" value=" Details " name="ButtonDetailsCPU" onclick="DetailsCPU" title="Click here to display more processor details in a separate window."></td>
</tr>
<tr id="CPUFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="MemHeader">
    <td colspan="4">&nbsp;</td>
    <td>Banks:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Modules:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Total (MB):</td>
    <td colspan="4">&nbsp;</td>
</tr>
<tr id="MemRow">
    <td><input type="checkbox" id="CheckboxMemory" name="CheckboxMemory" checked=True title="Deselect this checkbox if you want to exclude the memory from the inventory."></td>
    <td><label for="CheckboxMemory">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxMemory">Memory:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MemoryBanks"   size="10" readonly title="This read-only field will display the number of memory banks (sockets total)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MemoryModules" size="10" readonly title="This read-only field will display the number of memory modules (sockets used)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MemorySize"    size="16" readonly title="This read-only field will display the total amount of physical memory in MB."></td>
    <td colspan="2">&nbsp;</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsMemory" class="Button" type="button" value=" Details " name="ButtonDetailsMemory" onclick="DetailsMemory" title="Click here to display more memory details in a separate window."></td>
</tr>
<tr id="MemFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="HardDiskHeader">
    <td colspan="4">&nbsp;</td>
    <td>Disk #:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Size (GB):</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Interface:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk0">
    <td><input type="checkbox" id="CheckboxHDD" name="CheckboxHDD" checked=True title="Deselect this checkbox if you want to exclude the harddisk(s) from the inventory."></td>
    <td><label for="CheckboxHDD">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxHDD">Harddisk<span id="MultipleHDUs" style="display: none;">s</span>:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk0Index"     size="10" readonly title="This read-only field will display the disk number (zero based: 0...3)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk0Model"     size="40" readonly title="This read-only field will display the harddisk model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk0Size"      size="16" readonly title="This read-only field will display the harddisk size (capacity) in GB."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk0Interface" size="16" readonly title="This read-only field will display the harddisk's interface type (IDE/SCSI/S-ATA)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsHDD" class="Button" type="button" value=" Details " name="ButtonDetailsHDD" onclick="DetailsHDD" title="Click here to display more harddisk details in a separate window."></td>
</tr>
<tr id="HardDisk1" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk1Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk1Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk1Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk1Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk2" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk2Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk2Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk2Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk2Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk3" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk3Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk3Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk3Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk3Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk4" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk4Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk4Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk4Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk4Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk5" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk5Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk5Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk5Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk5Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk6" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk6Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk6Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk6Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk6Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDisk7" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="HardDisk7Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk7Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk7Size"      size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="HardDisk7Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="HardDiskFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="CDROMHeader">
    <td colspan="4">&nbsp;</td>
    <td>Drive:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Firmware:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Interface:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="CDROM0">
    <td><input type="checkbox" id="CheckboxCDROM" name="CheckboxCDROM" checked=True title="Deselect this checkbox if you want to exclude the CD/DVD-ROM drive(s) from the inventory."></td>
    <td><label for="CheckboxCDROM">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxCDROM">CDROM<span id="MultipleCDROMs" style="display: none;">s</span>:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM0Index"     size="10" readonly title="This read-only field will display the CD/DVD-ROM drive letter."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM0Model"     size="40" readonly title="This read-only field will display the CD/DVD-ROM drive model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM0Firmware"  size="16" readonly title="This read-only field will display the CD/DVD-ROM drive's firmware revision number."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM0Interface" size="16" readonly title="This read-only field will display the CD/DVD-ROM drive's interface type (IDE/SCSI/S-ATA)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsCDROMOM" class="Button" type="button" value=" Details " name="ButtonDetailsCDROMOM" onclick="DetailsCDROM" title="Click here to display more CD/DVD-ROM details in a separate window."></td>
</tr>
<tr id="CDROM1" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="CDROM1Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM1Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM1Firmware"  size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM1Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="CDROM2" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="CDROM2Index"     size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM2Model"     size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM2Firmware"  size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM2Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="CDROM3" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="CDROM3Index"     size="10"     readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM3Model"     size="40"     readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM3Firmware"  size="16"  readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="CDROM3Interface" size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="CDROMFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="VideoHeader">
    <td colspan="4">&nbsp;</td>
    <td>Video #:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Memory (MB):</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Resolution:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Video0">
    <td><input type="checkbox" id="CheckboxVideo" name="CheckboxVideo" checked=True title="Deselect this checkbox if you want to exclude the display adapter(s) from the inventory."></td>
    <td><label for="CheckboxVideo">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxVideo">Video:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoIndex0"  size="10" readonly title="This read-only field will display the (logical) display adapter number (zero based)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoModel0"  size="40" readonly title="This read-only field will display the display adapter model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMemory0" size="16" readonly title="This read-only field will display the amount of video memory in MB."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMode0"   size="16" readonly title="This read-only field will display the current video mode."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsVideo" class="Button" type="button" value=" Details " name="ButtonDetailsVideo" onclick="DetailsVideo" title="Click here to display more display adapter details in a separate window."></td>
</tr>
<tr id="Video1" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="VideoIndex1"  size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoModel1"  size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMemory1" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMode1"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Video2" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="VideoIndex2"  size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoModel2"  size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMemory2" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMode2"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Video3" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="VideoIndex3"  size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoModel3"  size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMemory3" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="VideoMode3"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="VideoFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="MonitorHeader">
    <td colspan="4">&nbsp;</td>
    <td>Monitor #:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td id="MonitorModelCaption">Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Manufacturer:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Serial #:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Monitor0">
    <td><input type="checkbox" id="CheckboxMonitor" name="CheckboxMonitor" checked=True title="Deselect this checkbox if you want to exclude the monitor(s) from the inventory."></td>
    <td><label for="CheckboxMonitor">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxMonitor">Monitor<span id="MultipleMonitors" style="display: none;">s</span>:</labe></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorIndex0"        size="10" readonly title="This read-only field will display the monitor number (zero based)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorModel0"        size="40" readonly title="This read-only field will display the monitor model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorManufacturer0" size="16" readonly title="This read-only field will display the monitor manufacturer."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorSerial0"       size="16" readonly title="This read-only field will display the monitor serial number."></td>
    <td>&nbsp;</td>
    <td><input id="ButtonDetailsMonitor" class="Button" type="button" value=" Details " name="ButtonDetailsMonitor" onclick="DetailsMonitor" title="Click here to display more monitor details in a separate window."></td>
</tr>
<tr id="Monitor1" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="MonitorIndex1"        size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorModel1"        size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorManufacturer1" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorSerial1"       size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Monitor2" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="MonitorIndex2"        size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorModel2"        size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorManufacturer2" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorSerial2"       size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="Monitor3" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="MonitorIndex3"        size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorModel3"        size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorManufacturer3" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MonitorSerial3"       size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="MonitorFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="SoundHeader">
    <td colspan="6">&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Manufacturer:</td>
    <td colspan="4">&nbsp;</td>
</tr>
<tr id="SoundRow">
    <td><input type="checkbox" name="CheckboxSound" checked=True title="Deselect this checkbox if you want to exclude the sound card from the inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <th align="left">Sound:</th>
    <td colspan="3">&nbsp;</td>
    <td><input type="text" name="SoundCardModel" size="40" readonly title="This read-only field will display the sound card model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="SoundCardManufacturer" size="16" readonly title="This read-only field will display the name of the sound card manufacturer."></td>
    <td colspan="3">&nbsp;</td>
    <td><input id="ButtonDetailsSound" class="Button" type="button" value=" Details " name="ButtonDetailsSound" onclick="DetailsSound" title="Click here to display more sound card details in a separate window."></td>
</tr>
<tr id="SoundFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="NICHeader">
    <td colspan="4">&nbsp;</td>
    <td>NIC #:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Address:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Speed:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="NIC0">
    <td><input type="checkbox" id="CheckboxNIC" name="CheckboxNIC" checked=True title="Deselect this checkbox if you want to exclude the network adapter(s) from the inventory."></td>
    <td><label for="CheckboxNIC">&nbsp;&nbsp;&nbsp;</label></td>
    <th align="left"><label for="CheckboxNIC">NIC<span id="MultipleNICs" style="display: none;">s</span>:</label></th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICIndex0"   size="10" readonly title="This read-only field will display the network adapter number (zero based: 0...3)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICModel0"   size="40" readonly title="This read-only field will display the network adapter model."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MACAddress0" size="16" readonly title="This read-only field will display the network adapter's MAC address."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICSpeed0"   size="16" readonly title="This read-only field will display the network adapter's link speed in kB/s."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsNIC" class="Button" type="button" value=" Details " name="ButtonDetailsNIC" onclick="DetailsNIC" title="Click here to display more network adapter details in a separate window."></td>
</tr>
<tr id="NIC1" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="NICIndex1"   size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICModel1"   size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MACAddress1" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICSpeed1"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="NIC2" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="NICIndex2"   size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICModel2"   size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MACAddress2" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICSpeed2"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="NIC3" style="display: none;">
    <td colspan="4">&nbsp;</td>
    <td><input type="text" name="NICIndex3"   size="10" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICModel3"   size="40" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MACAddress3" size="16" readonly></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="NICSpeed3"   size="16" readonly></td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="NICFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="MainBoardHeader">
    <td colspan="4">&nbsp;</td>
    <td>Chassis:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Model:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Manufacturer:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Version:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="MainBoardRow">
    <td><input type="checkbox" name="CheckboxMainBoard" checked=True title="Deselect this checkbox if you want to exclude the main board and system enclosure from the inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <th align="left">Main Board:</th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="ChassisType"    size="10" readonly title="This read-only field will display the computer's chassis type."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MBModel"        size="40" readonly title="This read-only field will display the main board type."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MBManufacturer" size="16" readonly title="This read-only field will display the name of the main board manufacturer."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="MBVersion"      size="16" readonly title="This read-only field will display the main board version."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsMainBoard" class="Button" type="button" value=" Details " name="ButtonDetailsMainBoard" onclick="DetailsMainBoard" title="Click here to display more main board and system enclosure details."></td>
</tr>
<tr id="MainBoardFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="PortsHeader">
    <td colspan="4">&nbsp;</td>
    <td>USB:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>System Slots:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Parallel:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Serial:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="PortsRow">
    <td><input type="checkbox" name="CheckboxPorts" checked=True title="Deselect this checkbox if you want to exclude the ports summary from the inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <th align="left">Ports:</th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="USB"      size="10" readonly title="This read-only field will tell if USB is supported."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="Slots"    size="40" readonly title="This read-only field will display the number and types of system slots (AGP/PCI)."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="Parallel" size="16" readonly title="This read-only field will display the number of parallel ports."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="Serial"   size="16" readonly title="This read-only field will display the number of serial ports."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsPorts" class="Button" type="button" value=" Details " name="ButtonDetailsPorts" onclick="DetailsPorts" title="Click here to display more details on the available ports."></td>
</tr>
<tr id="PortsFooter">
    <td colspan="13">&nbsp;</td>
</tr>
<tr id="BIOSHeader">
    <td colspan="4">&nbsp;</td>
    <td>Manufacturer:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Type:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Version:</td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td>Date:</td>
    <td colspan="2">&nbsp;</td>
</tr>
<tr id="BIOSRow">
    <td><input type="checkbox" name="CheckboxBIOS" checked=True title="Deselect this checkbox if you want to exclude the BIOS from the inventory."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <th align="left">BIOS:</th>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="BIOSManufacturer" size="10" readonly title="This read-only field will display the name of the BIOS manufacturer."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="BIOSModel"        size="40" readonly title="This read-only field will display the BIOS description."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="BIOSVersion"      size="16" readonly title="This read-only field will display the BIOS version number."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input type="text" name="BIOSDate"         size="16" readonly title="This read-only field will display the BIOS release date."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonDetailsBIOS" class="Button" type="button" value="Details" name="ButtonDetailsBIOS" onclick="DetailsBIOS" title="Click here to display more BIOS details."></td>
</tr>
<tr id="BIOSFooter">
    <td colspan="13">&nbsp;</td>
</tr>
</tbody>
</table>

<div style="height: 0.5em;"></div>

<table border="0" cellpadding="0" cellspacing="10">
<tr>
    <td><input id="ButtonCopy"     class="Button" type="button" value="Copy"     name="ButtonCopy"     onclick="CopyToClipboard" title="Click here to copy the results to the clipboard. The data in the clipboard will be in tab delimited format. Paste the data in a spreadsheet, using tab as the only delimiter, to create reports."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonSave"     class="Button" type="button" value="Save"     name="ButtonSave"     onclick="SaveFile"        title="Click here to save the results, in tab delimited format, to a file."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonPrint"    class="Button" type="button" value="Print"    name="ButtonPrint"    onclick="PrintPreview"    title="Click here to print the results."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonHelp"     class="Button" type="button" value="Help"     name="ButtonHelp"     onclick="HelpMsg"       title="Click this button to display the Command Line Help."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonCredits"  class="Button" type="button" value="Credits"  name="ButtonCredits"  onclick="Credits"       title="Click this button to display the Credits window."></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><input id="ButtonSettings" class="Button" type="button" value="Settings" name="ButtonSettings" onclick="Configure"     title="Click this button to edit the settings."></td>
</tr>
</table>

<p>Basic Hardware Inventory,&nbsp; Version <span id="AppVersion">0.00</span><br>
<span style="font-size: 80%;">&copy; 2005 - 2012, Rob van der Woude<br>
<a href="http://www.robvanderwoude.com/hardware.php" target="_blank">http://www.robvanderwoude.com/hardware.php</a></span></p>

</div>

</body>
</html>

page last uploaded: 13 January 2012, 22:30