Tuesday, September 2, 2008

HTML Application to Inventory Windows Computers

During my many attempts at scripting, I have expanded on existing scripts to accomplish a goal. This goal was to provide an "application" for our helpdesk staff (and myself) an easy way to inventory a group of computers. The script below will allow for an inventory of a single computer, a group of computers imported from a text file, or an entire domain through Active Directory. Each computer that is inventoried will have an Excel workbook created with multiple sheets that contain different types of information. There are sheets for hardware, software, and printers. The script also provides a way for the user to change the output directory in the event that there are a lot of computers included in the operation. The script requires that the WMI service and DCOM be running on the computers, as well as the appropriate permissions on the machine (such as local administrator). There is a log that will be created when the script is run. This log will contain the name of the computer inventoried, the date, and if the operation was a success or what error occurred. The script is below.


<html>
<head>
<title>Inventory Computers</title>

<HTA:APPLICATION
ID="objHTAInventory"
APPLICATIONNAME="HTA_Inventory"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>

<SCRIPT Language="VBScript">

'*******************************************************************************
'Script to accept a text file as source of machine names, then create a new
' Excel workbook for each computer in the file and save the workbook as the
' computer name. Each workbook will contain a sheet for hardware, software,
' printers, services, and general information.
'Created by Brian Bohanon
'Created: 7/7/2008
'*******************************************************************************
Option Explicit

'Global Variables
Dim arrFileLines() 'array to hold computer names
Dim tst 'variable for file
Dim i, j, k, l 'global counters
'Objects
Dim objFSO, objFile, objDialog, objExcel, objWMIService, objWorkbook
Dim objPrintItem, objDiskDrive, objExplorer, objLocalWMIService, objLocalItem
Dim objOSItem, objBIOS, objSetting, objQuickFix, objSoftware, objService
Dim objDrive, objNet, objProcItem, objSCSIItem, objVideo, objDisk
'Collections
Dim colOSItems, colBIOS, colSettings, colQuickFixes, colSoftware, colServices
Dim colPrintItems, colDisks, colDiskDrives, colDrives, colNet, colProcItems
Dim colSCSIItems, colVideo, colLocalItems
Dim WshShell 'Provides access to WScript.Shell
Dim srcFileName 'source file
Dim intResult 'used to test open file dialog
Dim strComputer 'active computer to inventory
Dim strDirectory 'Local directory
Dim strLocalComputer 'Local computer script is running on
Dim intHorizontal, intVertical, intLeft, intTop

'Constants
Const xlLeft = -4131
Const xlHorizontal = -4128

'*******************************************************************************
'Sub routines
'*******************************************************************************

Sub Window_onLoad
Set WshShell = CreateObject("WScript.Shell")
strLocalComputer = "."
'Set current directory to Desktop & display on page
strDirectory = WshShell.SpecialFolders("Desktop") & "\"
DirectorySpan.innerhtml = "The files will be saved to " & strDirectory

'Set window size
window.resizeTo 550, 750

Set objLocalWMIService = GetObject("winmgmts:\\" & strLocalComputer &_
"\root\cimv2")
Set colLocalItems = objLocalWMIService.ExecQuery("Select * From " &_
"Win32_DesktopMonitor")

'Compensation for multiple video adapters, i.e. laptops
For Each objLocalItem in colLocalItems
If intHorizontal <> "" Then
Exit For
Else
'get the current resolution
intHorizontal = objLocalItem.ScreenWidth
intVertical = objLocalItem.ScreenHeight
End If
Next
'divide the center on the screen
intLeft = (intHorizontal - 550) / 2
intTop = (intVertical - 650) / 2
window.moveTo intLeft, intTop

Set objLocalWMIService = Nothing
Set objLocalItem = Nothing
Set WshShell = Nothing

End Sub

'*******************************************************************************

Sub CreateLog()

On Error Resume Next

Dim objFile
Dim strFile, strText

'Create log file
strFile = "InventoryLog_" & Month(Date()) & "_" & Day(Date()) & ".txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)

Set objFile = Nothing

'Write headers to the log file
strText = "Computer Name,Date,Result,Return Code"
Set objFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objFile.WriteLine(strText)

'Reset strText for later use
strText = ""

Set objFSO = Nothing
Set objFile = Nothing
End Sub

'*******************************************************************************

'Used to append the log for each computer the script is run against
Sub WriteLog(strErrorNumber)

On Error Resume Next

Dim objFile, objTextFile
Dim strFile, strText

strFile = "InventoryLog_" & Month(Date()) & "_" & Day(Date()) & ".txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Check to see if the log exists
If objFSO.FileExists(strDirectory & strFile) Then
'Write to the log
Select Case strErrorNumber
Case 0
' Success
'
strText = strComputer & "," & Date() & "," & "Success"
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
Case 70
'
' Run-time error '70': Permission denied
'
strText = strComputer & "," & Date() & "," & "Permission denied," &_
strErrorNumber
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
'
Case 462
'
' The remote server machine does not exist or is unavailable
'
strText = strComputer & "," & Date() & "," & "Machine does not exist or " &_
"is unavailable," & strErrorNumber
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
'
Case -2147217375
'
' Unknown/undocumented runtime error (till this time)
' The remote server machine name was assigned erroneously
strText = strComputer & "," & Date() & "," & "Unknown Error," & strErrorNumber
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
'
Case Else
'
' Unhandled Error
'
strText = strComputer & "," & Date() & "," & "Unhandled VBScript Error," &_
strErrorNumber
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
'
End Select
Else
'If the log doesn't exist, create it
CreateLog()
End If

Set objTextFile = Nothing
Set objFile = Nothing
Set objFSO = Nothing

End Sub

'*******************************************************************************
'Cretes the window to tell the user the script is running
Sub ProgressBar()

On Error Resume Next

'Provide access to the local computer
strLocalComputer = "."
Set WshShell = CreateObject("WScript.Shell")
Set objLocalWMIService = GetObject("Winmgmts:\\" & strLocalComputer & "\root\cimv2")
Set colLocalItems = objLocalWMIService.ExecQuery("Select * From " &_
"Win32_DesktopMonitor")
'Allow for multiple video cards
For Each objLocalItem in colLocalItems
If intHorizontal <> "" Then
Exit For
Else
'Get the screen resolution
intHorizontal = objLocalItem.ScreenWidth
intVertical = objLocalItem.ScreenHeight
End If
Next

Set objExplorer = CreateObject _
("InternetExplorer.Application")

'Default address when window opens
objExplorer.Navigate "about:blank"
'Remove toolbars
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
'Center the window on the screen
objExplorer.Left = (intHorizontal - 400) / 2
objExplorer.Top = (intVertical - 200) / 2
objExplorer.Width = 400
objExplorer.Height = 200
objExplorer.Visible = 1

'Make the cursor into an hourglass to show busy
objExplorer.Document.Body.Style.Cursor = "wait"

'Window title
objExplorer.Document.Title = "Inventory script in progress"
'Message for status, including the current computer
objExplorer.Document.Body.InnerHTML = "The inventory script is being processed " &_
" for computer " & strComputer &_
". This might take several minutes to complete."

'Create the workbook for the current computer
CreateWorkbook(strComputer)

'Reset the cursor to normal
objExplorer.Document.Body.Style.Cursor = "default"

'Close Internet Explorer window
objExplorer.Quit

Set objLocalWMIService = Nothing
Set objLocalItem = Nothing
Set objExplorer = Nothing
Set WshShell = Nothing

End Sub

'*******************************************************************************

'Create a new Excel workbook
Sub CreateWorkbook(strComputerName)

On Error Resume Next

Dim n, a
n = 3
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
Application.DisplayAlerts = False
Set objWorkbook = objExcel.Workbooks.Add()

'Create Sheet named %computername% for general information
objExcel.Worksheets("Sheet1").Name = strComputerName
GetSystemInfo(strComputerName)
If SoftwareCheckbox.Checked Then
n = n + 1
'Create Sheet named software
objExcel.Worksheets.Add
objExcel.Worksheets("Sheet" & n).Name = "Software"
objExcel.Worksheets("Software").Activate
GetSoftwareInfo()
End If
If ServicesCheckbox.Checked Then
n = n + 1
'Create Sheet named services
objExcel.Worksheets.Add
objExcel.Worksheets("Sheet" & n).Name = "Services"
objExcel.Worksheets("Services").Activate
GetServicesInfo()
End If
If HardwareCheckbox.Checked Then
n = n + 1
'Create Sheet named hardware - e.g. disk drives, memory, processor
objExcel.Worksheets.Add
objExcel.Worksheets("Sheet" & n).Name = "Hardware"
objExcel.Worksheets("Hardware").Activate
GetHardwareInfo()
End If
If PrintersCheckbox.Checked Then
n = n + 1
'Create Sheet named printers
objExcel.Worksheets.Add
objExcel.Worksheets("Sheet" & n).Name = "Printers"
objExcel.Worksheets("Printers").Activate
GetPrinterInfo()
End If

objExcel.Worksheets("Sheet2").Delete
objExcel.Worksheets("Sheet3").Delete
If n <> 1 Then
a = n - 1
objExcel.Worksheets(strComputerName).Move objExcel.Worksheets(1)
End If

objExcel.Worksheets(strComputerName).Activate
'Save the workbook to the desktop
objWorkbook.SaveAs(strDirectory & strComputerName & "_Inventory_" &_
Month(Date()) & "_" & Day(Date()) & "_" & Year(Date()) & ".xls")
'Close Excel
objExcel.Quit

Set objExcel = nothing

End Sub

'*******************************************************************************

'Get General information about system
Sub GetSystemInfo(strCompName)

On Error Resume Next

Dim s, t 'counters
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Set colOSItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

'start the counter for all of the loops
s = 1 'row counter
t = 1 'column counter

' Section header
objExcel.Cells(s, t).Value = "Computer Information"
objExcel.Cells(s, t).Font.Bold = True
s = s + 1
objExcel.Cells(s, t).Value = "Computer Name: "
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = strCompName

'Get OS information
s = s + 2
t = 1

For Each objOSItem in colOSItems
objExcel.Cells(s, t).Value = "Operating System:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.Caption
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "Description:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.Description
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "InstallDate:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.InstallDate
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "Organization:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.Organization
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "RegisteredUser:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.RegisteredUser
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "SerialNumber:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.SerialNumber
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "ServicePackMajorVersion:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = "SP " & objOSItem.ServicePackMajorVersion
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "ServicePackMinorVersion:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.ServicePackMinorVersion
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "Version:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.Version
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "WindowsDirectory:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objOSItem.WindowsDirectory
s = s + 1
t = t - 1
Next

Set objOSItem = nothing

s = s + 1

'Section header
objExcel.Cells(s, t).Value = "Physical Machine Information"
objExcel.Cells(s, t).Font.Bold = True

s = s + 1

'Insert hardware serial number
For each objBIOS in colBIOS
objExcel.Cells(s, t).Value = "Serial Number"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objBIOS.SerialNumber
Next

Set objBIOS = nothing

s = s + 1
t = 1

'Physical Machine information
For Each objSetting in colSettings
objExcel.Cells(s, t).Value = "Manufacturer:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objSetting.Manufacturer
s = s + 1
t = t - 1

s = s + 1
t = 1
objExcel.Cells(s, t).Value = "Model:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objSetting.Model
s = s + 1
t = t - 1
objExcel.Cells(s, t).Value = "System Type:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = objSetting.SystemType
Next

Set objSetting = nothing

' Autofit the columns
objExcel.Columns("A:Z").EntireColumn.AutoFit
objExcel.Columns("A:Z").HorizontalAlignment = xlLeft

End Sub

'*******************************************************************************

'Get Installed Software and hotfixes
Sub GetSoftwareInfo()

On Error Resume Next

Dim s, t 'counters
s = 1
t = 1
Set colQuickFixes = objWMIService.ExecQuery("Select * from " &_
"Win32_QuickFixEngineering")
Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")

objExcel.Cells(s, t) = "Software"
objExcel.Cells(s, t).Font.Bold = True
s = s + 1
objExcel.Cells(s, t) = "Caption:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Version:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Description:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Vendor:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Identiying Number:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Install Date:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Install Location:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Package Cache:"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

For Each objSoftware in colSoftware
objExcel.Cells(s, t) = objSoftware.Caption
t = t + 1
objExcel.Cells(s, t) = objSoftware.Name
t = t + 1
objExcel.Cells(s, t) = objSoftware.Version
t = t + 1
objExcel.Cells(s, t) = objSoftware.Description
t = t + 1
objExcel.Cells(s, t) = objSoftware.Vendor
t = t + 1
objExcel.Cells(s, t) = objSoftware.IdentifyingNumber
t = t + 1
objExcel.Cells(s, t) = objSoftware.InstallDate2
t = t + 1
objExcel.Cells(s, t) = objSoftware.InstallLocation
t = t + 1
objExcel.Cells(s, t) = objSoftware.PackageCache
t = 1
s = s + 1
Next

Set objSoftware = nothing

s = s + 1
t = 1

'Section header
objExcel.Cells(s, t) = "Installed Hotfixes"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1

'Column headers
objExcel.Cells(s, t) = "Hot Fix ID:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Description:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Installed By:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Install Date:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Service Pack Level:"
objExcel.Cells(s, t).Font.Bold = TRUE

'Hotfix data
For Each objQuickFix in colQuickFixes
s = s + 1
t = 1

If objQuickFix.HotFixID = "File 1" Then
objExcel.Cells(s, t) = objQuickFix.ServicePackInEffect
Else
objExcel.Cells(s, t) = objQuickFix.HotFixID
End If
t = t + 1
objExcel.Cells(s, t) = objQuickFix.Description
t = t + 1
objExcel.Cells(s, t) = objQuickFix.InstalledBy
t = t + 1
objExcel.Cells(s, t) = objQuickFix.InstalledOn
t = t + 1
objExcel.Cells(s, t) = objQuickFix.ServicePackInEffect
Next

Set objQuickFix = nothing

' Autofit the columns
objExcel.Columns("A:Z").EntireColumn.AutoFit
objExcel.Columns("A:Z").HorizontalAlignment = xlLeft

End Sub

'*******************************************************************************

Sub GetServicesInfo()

On Error Resume Next

Set colServices = objWMIService.ExecQuery("Select * From Win32_Service")

Dim s, t
s = 1
t = 1

'Column headers
objExcel.Cells(s, t).Value = "Service"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = "Status"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = "StartMode"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = "StartName"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t).Value = "PathName"
objExcel.Cells(s, t).Font.Bold = TRUE

'Services data
For Each objService in colServices
s = s + 1
objExcel.Cells(s, 1) = objService.Name
objExcel.Cells(s, 2) = objService.State
objExcel.Cells(s, 3) = objService.StartMode
objExcel.Cells(s, 4) = objService.StartName
objExcel.Cells(s, 5) = objService.PathName
if objService.State = "Stopped" then
objExcel.Cells(s, 2).Font.ColorIndex = 3
end if
Next

Set objService = nothing

' Autofit the first column to fit the longest service name
objExcel.Columns("A:Z").EntireColumn.AutoFit
objExcel.Columns("A:Z").HorizontalAlignment = xlLeft


End Sub

'*******************************************************************************

Sub GetHardwareInfo()

On Error Resume Next

Dim s, t
Dim video_ram, disk_size, disk_free, diskDrive_size, phys_ram

s = 1
t = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk")
Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
Set colDrives = objFSO.Drives
Set colNet = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
Set colProcItems = objWMIService.ExecQuery("Select * from Win32_Processor")
Set colSCSIItems = objWMIService.ExecQuery("Select * from Win32_SCSIController")
Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
Set colVideo = objWMIService.ExecQuery("Select * from Win32_VideoController")

'Section header
objExcel.Cells(s, t) = "Logical Drives"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column headers
objExcel.Cells(s, t) = "Drive letters:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Volume Name:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Description:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "File System:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Total Size (GB):"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Free Space (GB):"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Volume Serial Number:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Compressed:"
objExcel.Cells(s, t).Font.Bold = TRUE
s = s + 1
t = 1

'Logical disk data
For each objDisk in colDisks
objExcel.Cells(s, t) = objDisk.DeviceID
t = t + 1
objExcel.Cells(s, t) = objDisk.VolumeName
t = t + 1
objExcel.Cells(s, t) = objDisk.Description
t = t + 1
objExcel.Cells(s, t) = objDisk.FileSystem
t = t + 1
'Convert into GB
disk_size = objDisk.Size / 1073741824
objExcel.Cells(s, t) = int(disk_size)
t = t + 1
'Convert into GB
disk_free = objDisk.FreeSpace / 1073741824
objExcel.Cells(s, t) = int(disk_free)
t = t + 1
objExcel.Cells(s, t) = objDisk.VolumeSerialNumber
t = t + 1
objExcel.Cells(s, t) = objDisk.Compressed
t = 1
s = s + 1
Next

Set objDisk = nothing

t = 1
s = s + 1

'Section header
objExcel.Cells(s, t) = "Physical Drives"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column headers
objExcel.Cells(s, t) = "Caption:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Device ID:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Index:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Interface Type:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Manufacturer:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Media Loaded:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Media Type:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Model:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Partitions:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "SCSI Bus:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "SCSI Logical Unit:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "SCSI Port:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "SCSI TargetId:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Sectors Per Track:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Signature:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Size (GB):"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Status:"
objExcel.Cells(s, t).Font.Bold = TRUE

'Physical disk data
For each objDiskDrive in colDiskDrives

s = s + 1
t = 1

objExcel.Cells(s, t) = objDiskDrive.Caption
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.DeviceID
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Index
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.InterfaceType
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Manufacturer
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.MediaLoaded
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.MediaType
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Model
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Partitions
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.SCSIBus
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.SCSILogicalUnit
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.SCSIPort
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.SCSITargetId
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.SectorsPerTrack
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Signature
t = t + 1
'convert into GB
diskDrive_size = objDiskDrive.Size / 1073741824
objExcel.Cells(s, t) = int(diskDrive_size)
t = t + 1
objExcel.Cells(s, t) = objDiskDrive.Status
Next

Set objDiskDrive = nothing

'Get SCSI Controller

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "SCSI Information"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column headers
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Device ID:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Driver Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "PNP Device ID:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Protocol Supported:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Status Information:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Configuration Manager Error Code:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Configuration Manager User Configuration:"
objExcel.Cells(s, t).Font.Bold = TRUE

'SCSI controller data
For Each objSCSIItem in colSCSIItems
s = s + 1
t = 1

objExcel.Cells(s, t) = objSCSIItem.Name
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.DeviceID
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.DriverName
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.PNPDeviceID
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.ProtocolSupported
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.StatusInfo
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.ConfigManagerErrorCode
t = t + 1
objExcel.Cells(s, t) = objSCSIItem.ConfigManagerUserConfig
Next

Set objSCSIItem = nothing

'Get BIOS information

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "BIOS Information"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column header
objExcel.Cells(s, t) = "Manufacturer:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Release Date:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Version:"
objExcel.Cells(s, t).Font.Bold = TRUE

'BIOS data
For each objBIOS in colBIOS
s = s + 1
t = 1

objExcel.Cells(s, t) = objBIOS.Manufacturer
t = t + 1
objExcel.Cells(s, t) = objBIOS.Name
t = t + 1
objExcel.Cells(s, t) = objBIOS.ReleaseDate
t = t + 1
objExcel.Cells(s, t) = objBIOS.Version
Next

Set objBIOS = nothing

'Get Processor information

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "Processor Information"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column headers
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Manufacturer:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Current Clock Speed (MHz):"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "L2 Cache Size (MB):"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Architecture:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Address Width (bits):"
objExcel.Cells(s, t).Font.Bold = TRUE

'Processor data
For Each objProcItem in colProcItems
s = s + 1
t = 1

objExcel.Cells(s, t) = objProcItem.Name
t = t + 1
objExcel.Cells(s, t) = objProcItem.Manufacturer
t = t + 1
objExcel.Cells(s, t) = objProcItem.CurrentClockSpeed
t = t + 1
objExcel.Cells(s, t) = objProcItem.L2CacheSize
t = t + 1
objExcel.Cells(s, t) = objProcItem.Architecture
t = t + 1
objExcel.Cells(s, t) = objProcItem.AddressWidth
Next

Set objProcItem = nothing

'Get Memory Information

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "Physical Memory Information"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column header
objExcel.Cells(s, t) = "Total Physical Memory (MB):"
objExcel.Cells(s, t).Font.Bold = TRUE

'Physical memory data
For Each objSetting in colSettings
s = s + 1
t = 1
'convert into MB
phys_ram = objSetting.TotalPhysicalMemory / 1048576
objExcel.Cells(s, t) = int(phys_ram)
Next

Set objSetting = nothing

'Get Video Information

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "Video Card Information"
objExcel.Cells(s, t).Font.Bold = TRUE

s = s + 1
t = 1

'Column header
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Description:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Driver Version:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Video Memory (MB):"
objExcel.Cells(s, t).Font.Bold = TRUE

'Video card data
For Each objVideo in colVideo
s = s + 1
t = 1
objExcel.Cells(s, t) = objVideo.Caption
t = t + 1
objExcel.Cells(s, t) = objVideo.Description
t = t + 1
objExcel.Cells(s, t) = objVideo.DriverVersion
t = t + 1
video_ram = objVideo.AdapterRAM / 1048576
objExcel.Cells(s, t) = int(video_ram)
Next

Set objVideo = nothing

'Get Network Adapter Information

t = 1
s = s + 2

'Section header
objExcel.Cells(s, t) = "NIC Information"
objExcel.Cells(s, t).Font.Bold = TRUE

'Column header
s = s + 1
t = 1
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "MAC Address:"
objExcel.Cells(s, t).Font.Bold = True
t = t + 1
objExcel.Cells(s, t) = "Manufacturer:"
objExcel.Cells(s, t).Font.Bold = TRUE

'Network card data
For Each objNet in colNet
'If virtual adapter, don't include
If objNet.MACAddress <> "" Then
s = s + 1
t = 1
objExcel.Cells(s, t) = objNet.Name
t = t + 1
objExcel.Cells(s, t) = objNet.MACAddress
t = t + 1
objExcel.Cells(s, t) = objNet.Manufacturer
End if
Next

Set objNet = Nothing
Set objFSO = Nothing

' Autofit the first column to fit the longest name
objExcel.Columns("A:Z").EntireColumn.AutoFit
objExcel.Columns("A:Z").HorizontalAlignment = xlLeft


End Sub

'*******************************************************************************

Sub GetPrinterInfo()

On Error Resume Next

Dim s, t
s = 1
t = 1

Set colPrintItems = objWMIService.ExecQuery("Select * from Win32_Printer")

'Section header
objExcel.Cells(s, t) = "Printer Information"
objExcel.Cells(s, t).Font.Bold = TRUE

'Column Headers
s = s + 1
t = 1

objExcel.Cells(s, t) = "Default:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Server Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Share Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Driver Name:"
objExcel.Cells(s, t).Font.Bold = TRUE
t = t + 1
objExcel.Cells(s, t) = "Port Name:"
objExcel.Cells(s, t).Font.Bold = TRUE

'List printer objects
For Each objPrintItem in colPrintItems
s = s + 1
t = 1
objExcel.Cells(s, t) = objPrintItem.Default
t = t + 1
objExcel.Cells(s, t) = objPrintItem.Name
t = t + 1
objExcel.Cells(s, t) = objPrintItem.ServerName
t = t + 1
objExcel.Cells(s, t) = objPrintItem.ShareName
t = t + 1
objExcel.Cells(s, t) = objPrintItem.DriverName
t = t + 1
objExcel.Cells(s, t) = objPrintItem.PortName
Next

Set objPrintItem = nothing

' Autofit the first column to fit the longest name
objExcel.Columns("A:Z").EntireColumn.AutoFit
objExcel.Columns("A:Z").HorizontalAlignment = xlLeft

End Sub

'*******************************************************************************
'Button Actions
'*******************************************************************************

'This sub is used if a file (array) of computers is input
Sub BrowseForInputFile()

On Error Resume Next
'Create File Dialog Object
Set objDialog = CreateObject("UserAccounts.CommonDialog")
Set WshShell = CreateObject("WScript.Shell")

'Start Logging
CreateLog()

'Open the source file that contains the list of computers
objDialog.Filter = "Text Files|*.txt"
objDialog.InitialDir = strDirectory
intResult = objDialog.ShowOpen

'If cancel button is hit
If intResult = 0 Then
'Reload the interface
RefreshHTA()
Else
'Set selected file to srcFileName
srcFileName = objDialog.FileName
'set counter to 0 index
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open the text file for reading
Set objFile = objFSO.OpenTextFile(srcFileName, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop

objFile.Close

Set objFile = Nothing
Set objFSO = Nothing

End If

'*******************************************************************************
'Loop through the array of computers, create a workbook with the computer name,
' get the list of services,
' and write out the services to the excel sheet
'*******************************************************************************

For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
'set computer to the current index in the array
strComputer = arrFileLines(l)
'connect to the computer's WMI service
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Select Case Err.Number
Case 0
'
' Success - begin the process
ProgressBar()
WriteLog(Err.Number) 'write success to the log
'
Case 70
'
' Run-time error '70': Permission denied
WriteLog(Err.Number)
'
Case 462
'
' The remote server machine does not exist or is unavailable
WriteLog(Err.Number)
'
Case -2147217375
'
' Unknown/undocumented runtime error (till this time)
' The remote server machine name was assigned erroneously
WriteLog(Err.Number)
Case Else
'
' Unhandled Run-time error (till this time)
WriteLog(Err.Number)
'
End Select

Next

Set objDialog = Nothing
Set WshShell = Nothing
Set objWMIService = Nothing

'Displays end of process on UI
CompletedJob()

End Sub

'*******************************************************************************
'This sub is used if a single computer name is put into the text box
Sub InventorySingleComputer()

On Error Resume Next

'Start Logging
CreateLog()

strComputer = SingleComputerName.value

Set WshShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Select Case Err.Number
Case 0
'
' Success - begin the process
ProgressBar()
WriteLog(Err.Number)
'
Case 70
'
' Run-time error '70': Permission denied
WriteLog(Err.Number)
'
Case 462
'
' The remote server machine does not exist or is unavailable
WriteLog(Err.Number)
'
Case -2147217375
'
' Unknown/undocumented runtime error (till this time)
' The remote server machine name was assigned erroneously
WriteLog(Err.Number)
Case Else
'
' Unhandled Run-time error (till this time)
WriteLog(Err.Number)
'
End Select

Set objWMIService = Nothing
'Displays end of process on UI
CompletedJob()

End Sub

'*******************************************************************************
'Use a list of computers from AD to get inventory
Sub InventoryDomainComputers()

On Error Resume Next
'Start Logging
CreateLog()

Dim strDomain
Dim objConnection, objCommand, objRecordSet
Const ADS_SCOPE_SUBTREE = 2
strDomain = DomainComputers.value

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://" & strDomain & "' " _
& "Where objectCategory='computer'"
objCommand.Properties("Page Size") = 1500
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

i = 0

Do Until objRecordSet.EOF
Redim Preserve arrFileLines(i)
arrFileLines(i) = objRecordSet.Fields("Name").Value
i = i + 1
'Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop

For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
'set computer to the current index in the array
strComputer = arrFileLines(l)
'connect to the computer's WMI service
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Select Case Err.Number
Case 0
'
' Success - begin the process
ProgressBar()
WriteLog(Err.Number) 'write success to the log
'
Case 70
'
' Run-time error '70': Permission denied
WriteLog(Err.Number)
'
Case 462
'
' The remote server machine does not exist or is unavailable
WriteLog(Err.Number)
'
Case -2147217375
'
' Unknown/undocumented runtime error (till this time)
' The remote server machine name was assigned erroneously
WriteLog(Err.Number)
Case Else
'
' Unhandled Run-time error (till this time)
WriteLog(Err.Number)
'
End Select

Next

Set objWMIService = Nothing
Set objConnection = Nothing
Set objCommand = Nothing
Set objRecordSet = Nothing

'Displays end of process on UI
CompletedJob()
End Sub

'*******************************************************************************
'Get a list from AD and display in new window for approval

Sub GetComputersFromAD()

On Error Resume Next

Dim strDomain, strDomainPath
Dim objConnection, objCommand, objRecordSet
Const ADS_SCOPE_SUBTREE = 2
strDomain = DomainComputers.value



Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCOmmand.ActiveConnection = objConnection

objCommand.CommandText = _
"Select Name, Location from 'LDAP://" & strDomain & "' " _
& "Where objectCategory='computer'"
objCommand.Properties("Page Size") = 500
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

i = 0

Do Until objRecordSet.EOF
Redim Preserve arrFileLines(i)
arrFileLines(i) = objRecordSet.Fields("Name").Value
i = i + 1
'Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop

DisplayDomainComputers(i)

End Sub

'*******************************************************************************

Sub DisplayDomainComputers(iCount)

On Error Resume Next
Dim strDomain, strDomainPath
Dim objConnection, objCommand, objRecordSet
Const ADS_SCOPE_SUBTREE = 2
'Write to a new window to get approval for list
strLocalComputer = "."
Set WshShell = CreateObject("WScript.Shell")
Set objLocalWMIService = GetObject("Winmgmts:\\" & strLocalComputer & "\root\cimv2")
Set colLocalItems = objLocalWMIService.ExecQuery("Select * From " &_
"Win32_DesktopMonitor")
'Allow for multiple video cards
For Each objLocalItem in colLocalItems
If intHorizontal <> "" Then
Exit For
Else
'Get the screen resolution
intHorizontal = objLocalItem.ScreenWidth
intVertical = objLocalItem.ScreenHeight
End If
Next

Set objExplorer = CreateObject _
("InternetExplorer.Application")

'Default address when window opens
objExplorer.Navigate "about:blank"
'Remove toolbars
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
'Center the window on the screen
objExplorer.Left = (intHorizontal - 400) / 2
objExplorer.Top = (intVertical - 200) / 2
objExplorer.Width = 400
objExplorer.Height = 200
objExplorer.Visible = 1

'Window title
objExplorer.Document.Title = "Approve Computers"
'Message for status, including the current computer
objExplorer.Document.Body.InnerHTML = iCount & " Computers were found in the query. " '&_
'"<input id=AcceptADbutton class=""button"" type=""button"" " &_
'"value=""Continue with Inventory..."" name=""AcceptAD_button"" " &_
'"onClick=""CloseIE"">"

Set objLocalWMIService = Nothing
Set objLocalItem = Nothing
Set WshShell = Nothing
Set objConnection = Nothing
Set objCommand = Nothing
Set objRecordSet = Nothing
Set objExplorer = Nothing

End Sub

'*******************************************************************************
'Sub used to change the default directory
Sub ChangeDirectory()

On Error Resume Next

Dim objShell, objFolder, objFolderItem, objPath
'Constants
Const WINDOW_HANDLE = 0
Const NO_OPTIONS = 0

Set objShell = CreateObject("Shell.Application")
'Create the folder dialog
Set objFolder = objShell.BrowseForFolder _
(WINDOW_HANDLE, "Select a folder:", NO_OPTIONS, strDirectory)
Set objFolderItem = objFolder.Self
'Get the selected path
objPath = objFolderItem.Path

'Handle the cancel button, keep current directory
If Err.Number <> 0 Then
strDirectory = strDirectory
Else
'append the \ to the end of the path
strDirectory = objPath & "\"
End If

'Display the new path in the UI
DirectorySpan.innerhtml = "The files will be saved to " & strDirectory

Set objShell = nothing
Set objFolder = nothing
Set objFolderItem = nothing
Set objPath = nothing

End Sub

'*******************************************************************************

Sub CompletedJob()

On Error Resume Next
'Display completion on the UI
StatusSpan.innerhtml = "<font size=""8"" color=""Red"">" &_
"<b>Inventory Completed</b></font>"
'Create Exit button
CloseSpan.innerhtml = "<input id=closebutton class=""button"" " &_
"type=""button"" value=""Exit"" name=""close_button"" " &_
"onClick=""CloseHTA"">"
End Sub

'*******************************************************************************
'Used to reload the UI
Sub RefreshHTA()
Location.Reload(True)
End Sub

'*******************************************************************************
'Used to close the UI
Sub CloseHTA()
window.close()
End Sub

'*******************************************************************************

</SCRIPT>
<body>
<table width="100%" border=0>
<tr>
<!--Title-->
<td valign="top"><b><u>Computer Inventory<u><b></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<!-- Display the current directory -->
<td valign="top"><span id=DirectorySpan></span></td>
</tr>
<tr>
<!-- Button To change the directory -->
<td valign="top"><input id=changedirectorybutton class="button" type="button"
value="Change Directory" name="changedirecgory_button"
onClick="ChangeDirectory"></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">
<!-- checkboxes -->
<table width="100%" border="none">
<tr>
<td>Items To Inventory</td>
</tr>
<tr>
<td><input type="checkbox"name="SoftwareCheckbox"value="1"> Software</td>
</tr>
<tr>
<td><input type="checkbox"name="HardwareCheckbox"value="1"> Hardware</td>
</tr>
<tr>
<td><input type="checkbox"name="ServicesCheckbox"value="1"> Services</td>
</tr>
<tr>
<td><input type="checkbox"name="PrintersCheckbox"value="1"> Printers</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Enter a single computer name...</td>
</tr>
<tr>
<!-- text field To enter a single computer -->
<td valign="top"><input type="text" name="SingleComputerName" size="25">
<input id=singlecomputerbutton class="button" type="button"
value="Inventory Computer" name="singlecomputer_button"
onClick="InventorySingleComputer"></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Or select the input file...</td>
</tr>
<tr>
<!-- button To browse For a list of computeres -->
<td valign="top"><input id=browsebutton class="button" type="button"
value="Browse..." name="browse_button" onClick="BrowseForInputFile"></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Or Enter a Domain To Get the list from...</td>
</tr>
<tr>
<!-- button To search domain For a list of computeres -->
<td valign="top"><input type="text" name="DomainComputers" size="25">
</tr>
<tr>
<!-- button To search domain For a list of computeres -->
<td valign="top"><input id=domainbutton class="button" type="button"
value="Calculate Number of Computers..." name="domain_button" onClick="GetComputersFromAD"></td>
</tr>
<tr>
<!-- button To inventory a list of computers from Domain -->
<td valign="top"><input id=domainbutton class="button" type="button"
value="Inventory all Domain Computers..." name="inventory_domain_button" onClick="InventoryDomainComputers"></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<!--area used To display the status -->
<td valign="top"><span id=StatusSpan></span></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<!-- area To put Exit button -->
<td valign="top"><span id=CloseSpan></span></td>
</tr>
</table>
</body>
</html>

2 comments:

Mandalar.Net said...

Run on my test server and log showing the following error message

"Unhandled VBScript Error,429"

Please, advise.

Thanks

Mandalar.Net said...

I run on my test server and showing the following error in log file

Unhandled VBScript Error,429

Please, advise.