Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Thu Mar 28, 2024 11:35 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: My modified audit.vbs...
PostPosted: Thu Feb 22, 2007 3:35 am 
Offline
Helper

Joined: Sat Sep 17, 2005 7:15 am
Posts: 71
Ok - I've been emailing Mike a few times, and I have an audit.vbs I'd like for some of the high-end users (and moderators) to take a look at.

I needed to modify this because I felt that I shouldn't have to have multiple audit.vbs files for different configurations. For example, I use the same audit.vbs to run against a dynamic OU that is being populated with computers daily and then again at a different time during the day where it will query a static list of servers.

I'm not totally done with it, as I'm not sure how far to go with the command-line switches...let me know - should I just mimic all the audit.conf settings?

Am I crazy, should I have even done this? :)

Basically, I added some command-line switches:
computer: (computername)
user: (domain\username)
password: (password)
config: (name of .conf file to use)
list: (path of computer list to run against)

I added a section that had some default configuration parameters, which get superseded by the command-line switches (i.e. if you downloaded and ran the file without having access to the config files).

I also added a path entry that prefixes against the configuration file statement:

[code]
strScriptPath = replace(wscript.scriptfullname,wscript.scriptname,"")

ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(strScriptPath & "\audit.config").ReadAll
[/code]

This code executes if no command-line switches are given. If the 'config' switch is specified, it will supersede the static entries in the script itself. Those are there as more of a failsafe than anything else.

I also modified the location for the user customizable software config gets loaded. Also, if you do not specify a path with backslashes, it will default to the script location to look for the config file.

I will add the code to take paths with spaces in it into consideration (i.e. you will have to enclose your paths with quotes when specifying them in the command-line switch).

Just want to hear what you think about it...
Rob

[code]
'''''''''''''''''''''''''''''''''''
' Open Audit '
' Software and Hardware Inventory '
' Outputs into MySQL '
' (c) Mark Unwin 2003 '
'''''''''''''''''''''''''''''''''''
Dim verbose
Public online
Dim strComputer
Dim mysql
Dim input_file
Dim email_to
Dim email_from
Dim email_failed
Dim email_server
Dim audit_local_domain
Dim local_domain
Dim sql
Dim comment
Dim net_mac_uuid
Dim blnCScript
Set objArgs = WScript.Arguments

If InStr(ucase(WScript.FullName),"CSCRIPT.EXE") Then
blnCScript = TRUE
Else
blnCScript = FALSE
End If


strScriptPath = replace(wscript.scriptfullname,wscript.scriptname,"")
form_total = ""

'Get command-line arguments
If objargs.count < 1 Then
' Below calls the file audit_include.vbs to setup the variables.
ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(strScriptPath & "\audit.config").ReadAll
Else
'Default variables
audit_location = "l"
verbose = "y"
online = "yesxml"
strComputer = "."
ie_visible = "n"
ie_auto_submit = "y"
ie_submit_verbose = "y"
ie_form_page = "http://yourserver/admin_pc_add_1.php"
non_ie_page = "http://yourserver/admin_pc_add_2.php"
input_file = ""
email_to = "you@yourdomain.com"
email_from = "openaudit@yourdomain.com"
email_server = ""
audit_local_domain = "n"
local_domain = "LDAP://yourdomain"
hfnet = "n"
Count = 0
number_of_audits = 20
script_name = "audit.vbs"
monitor_detect = "y"
printer_detect = "y"
software_audit = "y"
uuid_type = "mac"

For I = 0 to objArgs.Count - 1
If InStr(1,LCase(objargs(I)),"computer:") Then
arrComputer = split(lcase(objargs(I)),"computer:")
strComputer = arrComputer(1)
ElseIf InStr(1,LCase(objargs(I)),"user:") Then
arrUser = split(lcase(objargs(I)),"user:")
strUser = arrUser(1)
ElseIf InStr(1,LCase(objargs(I)),"password:") Then
arrPassword = split(lcase(objargs(I)),"password:")
strPass = arrPassword(1)
ElseIf InStr(1,LCase(objargs(I)),"config:") Then
arrConfig = split(lcase(objargs(I)),"config:")
strConfig = arrConfig(1)
If Not instr(objargs(I),"\") then
strConfig = strScriptPath & "\" & strConfig
End If
' Below calls the file audit_include.vbs to setup the variables.
ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(strConfig).ReadAll
ElseIf InStr(1,LCase(objargs(I)),"list:") Then
arrlist = split(lcase(objargs(I)),"list:")
input_file = arrList(1)
'If Not instr(objargs(I),chr(34)) then

'End If
Else

End If
Next
End If



' If any command line args given - use the first one as strComputer
'If Wscript.Arguments.Count > 0 Then
'strComputer = wscript.arguments(0)
'end if
'If Wscript.Arguments.Count > 1 Then
'strUser = wscript.arguments(1)
'end if
'If Wscript.Arguments.Count > 2 Then
'strPass = wscript.arguments(2)
'end if

if online = "p" then
Dim oIE
Dim bWaitforChoice
Dim ItemChosen
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Fullscreen = False
oIE.Toolbar = True
oIE.Statusbar = False
oIE.Navigate("about:blank")
oIE.document.ParentWindow.resizeto 800,600
oIE.document.WriteLn "<html>"
oIE.document.WriteLn "<head>"
oIE.document.WriteLn "<title>Open Audit - Audit Result</title>"
oIE.document.WriteLn "<style type=""text/css"">"
oIE.document.WriteLn "body {"
oIE.document.WriteLn " font-family: verdana;"
oIE.document.WriteLn " font-size: 9pt;"
oIE.document.WriteLn "}"
oIE.document.WriteLn "h1,h2 {"
oIE.document.WriteLn " font-family: Trebuchet MS;"
oIE.document.WriteLn "}"
oIE.document.WriteLn ".content {"
oIE.document.WriteLn " position: relative;"
oIE.document.WriteLn " width: 600px;"
oIE.document.WriteLn " min-width: 700px;"
oIE.document.WriteLn " margin: 0 0px 10px 0px;"
oIE.document.WriteLn " border: 1px solid black;"
oIE.document.WriteLn " background-color: white;"
oIE.document.WriteLn " padding: 10px;"
oIE.document.WriteLn " z-index: 3;"
oIE.document.WriteLn " font-family: verdana;"
oIE.document.WriteLn " font-size: 9pt;"
oIE.document.WriteLn "}"
oIE.document.WriteLn "</style>"
oIE.document.WriteLn "</head>"
oIE.document.WriteLn "<body>"
end if


''''''''''''''''''''''''''''''''''''
' Uncomment the 3 lines below to '
' have the script ask for a PC '
' to audit (name or IP) '
''''''''''''''''''''''''''''''''''''
'strAnswer = InputBox("PC to run audit on:", "Audit Script")
'If blnCScript Then wscript.echo "Input PC Name: " & strAnswer
'strComputer = strAnswer

''''''''''''''''''''''''''''''''''''
' Check that softwarefiles.xml '
' is correct '
' '
''''''''''''''''''''''''''''''''''''

if (software_audit = "y" and software_file_audit = "y") then
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse="true"
xmlDoc.load("softwarefiles.xml")

if (xmlDoc.parseError.errorCode <> 0) then
If blnCScript Then wscript.echo("Error Code: " & xmlDoc.parseError.errorCode)
If blnCScript Then wscript.echo("Error Reason: " & xmlDoc.parseError.reason)
If blnCScript Then wscript.echo("Error Line: " & xmlDoc.parseError.srcText)
If blnCScript Then wscript.echo("Error Line Number: " & xmlDoc.parseError.line)
If blnCScript Then wscript.echo("")
WScript.quit
end if
end if

''''''''''''''''''''''''''''''''''''''''
' Don't change the settings below here '
''''''''''''''''''''''''''''''''''''''''
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const ForAppending = 8


'''''''''''''''''''''''''''''
' Clear Failed Audits File '
'''''''''''''''''''''''''''''
' Check if failed_audits.txt exists, and create it if need be.
' If file exists - remove contents
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("failed_audits.txt") Then
Set objFile = objFSO.OpenTextFile("failed_audits.txt", 2)
objFile.WriteLine
objFile.Close
Else
Set objFile = objFSO.CreateTextFile("failed_audits.txt", 2)
objFile.WriteLine
objFile.Close
End If

'''''''''''''''''''''''''''''
' Process the manual input '
'''''''''''''''''''''''''''''
if strComputer <> "" then

if (IsConnectible(strComputer, "", "") OR (strComputer = ".")) Then
if strUser <> "" and strPass <> "" then
' Username & Password provided - assume not a domain local PC.
if verbose = "y" then
If blnCScript Then wscript.echo "Username and password provided - therefore assuming NOT a local domain PC."
end if
Set wmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set wmiNameSpace = wmiLocator.ConnectServer( strComputer, "root\default", strUser, strPass)
Set oReg = wmiNameSpace.Get("StdRegProv")
Set objWMIService = wmiLocator.ConnectServer(strComputer, "root\cimv2",strUser,strPass)
objWMIService.Security_.ImpersonationLevel = 3
end if
if strUser = "" and strPass = "" then
' No Username & Password provided - assume a domain local PC
if verbose = "y" then
If blnCScript Then wscript.echo "No username and password provided - therefore assuming local domain PC."
end if
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
end if
Audit (strComputer)
else
if verbose = "y" then
If blnCScript Then wscript.echo strComputer & " not available."
end if
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("failed_audits.txt", 8)
objFile.WriteLine strComputer
objFile.Close
end if
wscript.quit
end if


''''''''''''''''''''''''''''''''''''''''
' Audit the local domain, if requested '
''''''''''''''''''''''''''''''''''''''''
if audit_local_domain = "y" then
Const ADS_SCOPE_SUBTREE = 2
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 '" & local_domain & "' Where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Sort On") = "name"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

totcomp = objRecordset.recordcount -1
Redim comparray(totcomp) ' set array to computer count

Do Until objRecordSet.EOF
On Error Resume Next
strComputer = objRecordSet.Fields("Name").Value
comparray(count) = strComputer ' Feed computers into array
count = count + 1
if verbose = "y" then
If blnCScript Then wscript.echo "Computer Name from ldap: " & strComputer
end if
objRecordSet.MoveNext
Loop

num_running = HowMany
if verbose = "y" then
If blnCScript Then wscript.echo "Number of systems retrieved from ldap: " & Ubound(comparray)
If blnCScript Then wscript.echo "--------------"
end if

For i = 0 To Ubound(comparray)
' For i = 118 To 128
while num_running > number_of_audits
if verbose = "y" then
If blnCScript Then wscript.echo "Processes running (" & num_running & ") greater than number wanted (" & number_of_audits & ")"
If blnCScript Then wscript.echo "Therefore - sleeping for 4 seconds."
end if
wscript.Sleep 4000
num_running = HowMany
wend
if comparray(i) <> "" then
if verbose = "y" then
If blnCScript Then wscript.echo i & " of " & Ubound(comparray)
If blnCScript Then wscript.echo "Processes running: " & num_running
If blnCScript Then wscript.echo "Next System: " & comparray(i)
If blnCScript Then wscript.echo "--------------"
end if
command1 = "cscript " & script_name & " computer:" & comparray(i)
set sh1=WScript.CreateObject("WScript.Shell")
sh1.Run command1, 6, False
set sh1 = nothing
num_running = HowMany
end if
Next
end if


'''''''''''''''''''''''''''''''''''
' Read the text file if requested '
' and audit PCs within - line '
' by line '
'''''''''''''''''''''''''''''''''''
On Error Resume Next
if input_file <> "" then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFileReading = objFSO.OpenTextFile(input_file, 1)
objTextFileReading.ReadAll
dimarray = objTextFileReading.Line - 1
Redim comparray(dimarray)
Redim userarray(dimarray)
Redim passarray(dimarray)
objTextFileReading.close
Set objTextFileReading = objFSO.OpenTextFile(input_file, 1)
Do Until objTextFileReading.AtEndOfStream
strString = objTextFileReading.ReadLine
strSplit = split(strString, ",")
comparray(count) = strSplit(0)
userarray(count) = strSplit(1)
passarray(count) = strSplit(2)
count = count + 1
Loop
num_running = HowMany
if verbose = "y" then
If blnCScript Then wscript.echo "File " & input_file & " read into array."
If blnCScript Then wscript.echo "Number of systems retrieved from file: " & Ubound(comparray)
If blnCScript Then wscript.echo "--------------"
end if
For i = 0 To Ubound(comparray)
while num_running > number_of_audits
if verbose = "y" then
If blnCScript Then wscript.echo "Processes running (" & num_running & ") greater than number wanted (" & number_of_audits & ")"
If blnCScript Then wscript.echo "Therefore - sleeping for 4 seconds."
end if
wscript.Sleep 4000
num_running = HowMany
wend
if comparray(i) <> "" then
if verbose = "y" then
If blnCScript Then wscript.echo i & " of " & Ubound(comparray)
If blnCScript Then wscript.echo "Processes running: " & num_running
If blnCScript Then wscript.echo "Next System: " & comparray(i)
If blnCScript Then wscript.echo "--------------"
end if
command1 = "cscript " & script_name & " computer:" & comparray(i) & " user:" & userarray(i) & " password:" & passarray(i)
set sh1=WScript.CreateObject("WScript.Shell")
sh1.Run command1, 6, False
set sh1 = nothing
num_running = HowMany
end if
Next
end if



' Give the spawned scripts time to fail before emailing
wscript.Sleep 6000

' Open the file failed_audits.txt, read the contents and store in failed_audits variable
Set objFile = objFSO.OpenTextFile("failed_audits.txt", 1)
email_failed = objFile.ReadAll
objFile.Close

''''''''''''''''''''''''''''''''''
' Send an email of failed audits '
' if there are any '
''''''''''''''''''''''''''''''''''
if email_failed <> "" then
Set objEmail = CreateObject("CDO.Message")
objEmail.From = email_from
objEmail.To = email_to
objEmail.Subject = "Failed Open Audits."
objEmail.Textbody = "The following systems failed to audit: " & vbCRLF & email_failed
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = email_server
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end if

' Exit the script
wscript.quit

function Audit(strComputer)
start_time = Timer
dim dt : dt = Now()
timestamp = Year(dt) & Right("0" & Month(dt),2) & Right("0" & Day(dt),2) & Right("0" & Hour(dt),2) & Right("0" & Minute(dt),2) & Right("0" & Second(dt),2)

'''''''''''''''''''''''''''
' Who are we auditing '
'''''''''''''''''''''''''''
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
system_name = objItem.Name
domain = objItem.Domain
Next
Set colItems = objWMIService.ExecQuery("Select IPAddress from Win32_networkadapterconfiguration WHERE IPEnabled='TRUE'",,48)
For Each objItem in colItems
system_ip = objItem.IPAddress(0)
Next
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
user_name = wshNetwork.userName
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)
For Each objItem in colItems
system_id_number = clean(objItem.IdentifyingNumber)
system_vendor = clean(objItem.Vendor)
system_uuid = objItem.UUID
Next

if verbose = "y" then
If blnCScript Then wscript.echo "PC name supplied: " & strComputer
If blnCScript Then wscript.echo "PC name from WMI: " & system_name
full_system_name = LCase(system_name) & "." & LCase(domain)
If blnCScript Then wscript.echo "User executing this script: " & user_name
If blnCScript Then wscript.echo "System UUID: " & system_uuid
end if
ns_ip = NSlookup(system_name)
if verbose = "y" then
If blnCScript Then wscript.echo "IP: " & ns_ip
end if
if online = "p" then
oIE.document.WriteLn "<h1>Open Audit</h1><br />"
end if

''''''''''''''''''''''''''''''''
' Double check WMI is working '
''''''''''''''''''''''''''''''''
if ((UCase(strComputer) <> system_name) AND (strComputer <> ".") AND (strComputer <> full_system_name) AND (strComputer <> ns_ip) AND (strComputer <> system_ip)) then
email_failed = email_failed & strComputer & ", " & VBcrlf
ie = nothing
exit function
end if

'''''''''''''''''''''''''''''''''''''''
' Setup for Offline file creation '
'''''''''''''''''''''''''''''''''''''''
if online = "n" then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (system_name & ".txt", ForAppending, True)
end if

'''''''''''''''''''''''''''
' Network Information '
'''''''''''''''''''''''''''
comment = "Network Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next
Set colItems = objWMIService.ExecQuery("select * from win32_networkadapterconfiguration WHERE IPEnabled='TRUE' " _
& "AND ServiceName<>'AsyncMac' AND ServiceName<>'VMnetx' " _
& "AND ServiceName<>'VMnetadapter' AND ServiceName<>'Rasl2tp' " _
& "AND ServiceName<>'msloop' " _
& "AND ServiceName<>'PptpMiniport' AND ServiceName<>'Raspti' " _
& "AND ServiceName<>'NDISWan' AND ServiceName<>'NdisWan4' AND ServiceName<>'RasPppoe' " _
& "AND ServiceName<>'NdisIP' AND ServiceName<>'' AND Description<>'PPP Adapter.'",,48)
For Each objItem in colItems
net_ip = objItem.IPAddress(0)
net_mac = objItem.MACAddress
net_description = objItem.Description
net_dhcp_enabled = objItem.DHCPEnabled
net_dhcp_server = objItem.DHCPServer
net_dns_host_name = objItem.DNSHostName
if isarray(objItem.DNSServerSearchOrder) then
net_dns_server = objItem.DNSServerSearchOrder(0)
net_dns_server_2 = objItem.DNSServerSearchOrder(1)
end if
net_ip_subnet = objItem.IPSubnet(0)
net_wins_primary = objItem.WINSPrimaryServer
net_wins_secondary = objItem.WINSSecondaryServer
Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter WHERE MACAddress='" & objItem.MACAddress & "'",,48)
For Each objItem2 in colItems2
net_adapter_type = objItem2.AdapterType
net_manufacturer = objItem2.Manufacturer
Next
' Below is to account for a NULL in various items
if net_ip = "" then net_ip = "0.0.0.0"
if isnull(net_dns_server_2) then net_dns_server_2 = "none"
if isnull(net_dhcp_server) then net_dhcp_server = "none"
if net_dhcp_server = "" then net_dhcp_server = "none"
if isnull(net_dns_server) then net_dns_server = "none"
if isnull(net_ip_subnet) then net_ip_subnet = "none"
net_description = clean(net_description)
' IP Address padded with zeros so it sorts properly
MyIP = Split(net_ip, ".", -1, 1)
if MyIP(0) <> "169" AND MyIP(1) <> "254" then
MyIP(0) = right("000" & MyIP(0),3)
MyIP(1) = right("000" & MyIP(1),3)
MyIP(2) = right("000" & MyIP(2),3)
MyIP(3) = right("000" & MyIP(3),3)
net_ip = MyIP(0) & "." & MyIP(1) & "." & MyIP(2) & "." & MyIP(3)
if net_ip <> "000.000.000.000" then net_ip_address = net_ip end if
end if
if net_dhcp_server <> "255.255.255.255" then
form_input = "network^^^" & net_mac & "^^^" & net_description & "^^^" & net_dhcp_enabled _
& "^^^" & net_dhcp_server & "^^^" & net_dns_host_name & "^^^" & net_dns_server _
& "^^^" & net_ip & "^^^" & net_ip_subnet & "^^^" & net_wins_primary _
& "^^^" & net_wins_secondary & "^^^" & net_adapter_type & "^^^" & net_manufacturer & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""
if net_mac_uuid = "" then net_mac_uuid = net_mac end if
end if
Next

On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
net_domain = objItem.Domain
net_user_name = objItem.UserName
Next
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NTDomain",,48)
For Each objItem in colItems
net_client_site_name = objItem.ClientSiteName
net_domain_controller_address = objItem.DomainControllerAddress
net_domain_controller_name = objItem.DomainControllerName
Next

if isnull(net_ip_address) then net_ip_address = "" end if

if isnull(net_domain) then
oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", net_domain
if isnull(net_domain) then net_domain = "" end if
end if
if isnull(net_user_name) then
oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", net_user_name
if isnull(net_user_name) then net_user_name = "" end if
end if

if isnull(net_client_site_name) then net_client_site_name = "" end if
if isnull(net_domain_controller_address) then net_domain_controller_address = "" end if
if isnull(net_domain_controller_name) then net_domain_controller_name = "" end if

form_input = "system01^^^" & clean(net_ip_address) & "^^^" & clean(net_domain) _
& "^^^" & clean(net_user_name) & "^^^" & clean(net_client_site_name) _
& "^^^" & clean(Replace(net_domain_controller_address, "\\", "")) & "^^^" & clean(Replace(net_domain_controller_name, "\\", "")) & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""

'''''''''''''''''
' Make the UUID '
'''''''''''''''''
if uuid_type = "uuid" then
' Do nothing - system_uuid is the uuid already
end if

if uuid_type = "mac" then
if net_mac_uuid <> "" then system_uuid = net_mac_uuid end if
end if

if uuid_type = "name" then
if (system_name + "." + net_domain) <> "." then system_uuid = system_name + "." + net_domain end if
end if

' Defaults below here account for oddities
if ((isnull(system_uuid) OR system_uuid = "") AND (system_model <> "") AND (system_id_number <> "")) then system_uuid = system_model + "." + system_id_number end if
if (isnull(system_uuid) OR system_uuid = "" OR system_uuid = ".") then system_uuid = system_name + "." + net_domain end if
if system_uuid = "00000000-0000-0000-0000-000000000000" then system_uuid = system_name + "." + domain end if
if system_uuid = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" then system_uuid = system_name + "." + domain end if

form_input = ""
form_input = "audit^^^" & system_name & "^^^" & timestamp & "^^^" & system_uuid & "^^^" & user_name & "^^^" & ie_submit_verbose & "^^^" & software_audit & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment

'''''''''''''''''''''''''''''''''''''
' System Information & Timezone '
'''''''''''''''''''''''''''''''''''''
comment = "System Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)
mem_count = 0
For Each objItem in colItems
mem_count = mem_count + objItem.Capacity
Next
if mem_count > 0 then
mem_size = int(mem_count /1024 /1024)
else
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)
For Each objItem in colItems
mem_size = objItem.TotalPhysicalMemory
Next
mem_size = int(mem_size /1024)
end if
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
system_model = clean(objItem.Model)
system_name = clean(objItem.Name)
system_num_processors = clean(objItem.NumberOfProcessors)
system_part_of_domain = clean(objItem.PartOfDomain)
system_primary_owner_name = clean(objItem.PrimaryOwnerName)
domain_role = clean(objItem.DomainRole)
Next
if domain_role = "0" then domain_role_text = "Standalone Workstation" end if
if domain_role = "1" then domain_role_text = "Workstation" end if
if domain_role = "2" then domain_role_text = "Standalone Server" end if
if domain_role = "3" then domain_role_text = "Member Server" end if
if domain_role = "4" then domain_role_text = "Backup Domain Controller" end if
if domain_role = "5" then domain_role_text = "Primary Domain Controller" end if

Set colItems = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure",,48)
For Each objItem in colItems
system_system_type = Join(objItem.ChassisTypes, ",")
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_TimeZone",,48)
For Each objItem in colItems
tm_zone = clean(objItem.Caption)
tm_daylight = clean(objItem.DaylightName)
Next

if system_system_type = "1" then system_system_type = "Other" end if
if system_system_type = "2" then system_system_type = "Unknown" end if
if system_system_type = "3" then system_system_type = "Desktop" end if
if system_system_type = "4" then system_system_type = "Low Profile Desktop" end if
if system_system_type = "5" then system_system_type = "Pizza Box" end if
if system_system_type = "6" then system_system_type = "Mini Tower" end if
if system_system_type = "7" then system_system_type = "Tower" end if
if system_system_type = "8" then system_system_type = "Portable" end if
if system_system_type = "9" then system_system_type = "Laptop" end if
if system_system_type = "10" then system_system_type = "Notebook" end if
if system_system_type = "11" then system_system_type = "Hand Held" end if
if system_system_type = "12" then system_system_type = "Docking Station" end if
if system_system_type = "13" then system_system_type = "All in One" end if
if system_system_type = "14" then system_system_type = "Sub Notebook" end if
if system_system_type = "15" then system_system_type = "Space-Saving" end if
if system_system_type = "16" then system_system_type = "Lunch Box" end if
if system_system_type = "17" then system_system_type = "Main System Chassis" end if
if system_system_type = "18" then system_system_type = "Expansion Chassis" end if
if system_system_type = "19" then system_system_type = "SubChassis" end if
if system_system_type = "20" then system_system_type = "Bus Expansion Chassis" end if
if system_system_type = "21" then system_system_type = "Peripheral Chassis" end if
if system_system_type = "22" then system_system_type = "Storage Chassis" end if
if system_system_type = "23" then system_system_type = "Rack Mount Chassis" end if
if system_system_type = "24" then system_system_type = "Sealed-Case PC" end if

form_input = "system02^^^" & trim(system_model) & "^^^" & system_name _
& "^^^" & system_num_processors & "^^^" & system_part_of_domain _
& "^^^" & system_primary_owner_name & "^^^" & system_system_type _
& "^^^" & mem_size & "^^^" & system_id_number _
& "^^^" & trim(system_vendor) & "^^^" & domain_role_text _
& "^^^" & tm_zone & "^^^" & tm_daylight & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""

'''''''''''''''''''''''''''
' Windows Information '
'''''''''''''''''''''''''''
comment = "Windows Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
OSName = objItem.Caption
if objItem.OSType = "16" then
OSName = "Microsoft Windows 95"
end if
if objItem.OSType = "17" then
OSName = "Microsoft Windows 98"
if Instr(objItem.Name, "|") then
OSName = Left(objItem.Name, Instr(objItem.Name, "|") - 1)
else
OSName = objItem.Name
end if
end if
OSInstall = objItem.InstallDate
OSInstall = Left(OSInstall, 8)
OSInstallYear = Left(OSInstall, 4)
OSInstallMonth = Mid(OSInstall, 5, 2)
OSInstallDay = Right(OSInstall, 2)
OSInstall = OSInstallYear & "/" & OSInstallMonth & "/" & OSInstallDay
OSType = objItem.OSType
ServicePack = objItem.ServicePackMajorVersion
OSLang = objItem.OSLanguage
SystemBuildNumber = objItem.BuildNumber
sys_version = objItem.Version
system_description = clean(objItem.Description)
OSCaption = objItem.Caption
RegUser = clean(objItem.RegisteredUser)
WinDir = clean(objItem.WindowsDirectory)
RegOrg = clean(objItem.Organization)
Country = objItem.CountryCode
SerNum = objItem.SerialNumber
OSSerPack = objItem.ServicePackMajorVersion & "." & objItem.ServicePackMinorVersion
boot_device = clean(objItem.BootDevice)
build_number = clean(objItem.BuildNumber)
Version = objItem.Version
Next
form_input = "system03^^^" & boot_device & "^^^" & build_number _
& "^^^" & OSType _
& "^^^" & OSName & "^^^" & Country _
& "^^^" & system_description & "^^^" & OSInstall _
& "^^^" & RegOrg & "^^^" & OSLang _
& "^^^" & RegUser & "^^^" & SerNum _
& "^^^" & OSSerPack & "^^^" & Version & "^^^" & WinDir & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""

if online = "p" then
oIE.document.WriteLn "<div id=""content"">"
oIE.document.WriteLn "<table border=""0"" cellpadding=""2"" cellspacing=""0"" class=""content"">"
oIE.document.WriteLn "<tr><td colspan=""2""><b>Network Information</b></td></tr>"
oIE.document.WriteLn "<tr><td width=""250"">System Name: </td><td>" & system_name & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Description: </td><td>" & system_description & "</td></tr>"
oIE.document.WriteLn "<tr><td>MAC Address: </td><td>" & net_mac & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>IP Address: </td><td> " & net_ip_address & "</td></tr>"
oIE.document.WriteLn "<tr><td>Subnet: </td><td>" & net_ip_subnet & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>DHCP Enabled: </td><td>" & net_dhcp_enabled & "</td></tr>"
oIE.document.WriteLn "<tr><td>DHCP Server: </td><td>" & net_dhcp_server & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>WINS Server: </td><td>" & net_wins_primary & "</td></tr>"
oIE.document.WriteLn "<tr><td>DNS Server: </td><td>" & net_dns_server & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>NIC Manufacturer: </td><td>" & net_manufacturer & "</td></tr>"
oIE.document.WriteLn "<tr><td>Description: </td><td>" & net_description & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Part of Domain: </td><td>" & system_part_of_domain & "</td></tr>"
oIE.document.WriteLn "<tr><td>Domain Role: </td><td>" & domain_role_text & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Domain: </td><td>" & net_domain & "</td></tr>"
oIE.document.WriteLn "<tr><td>Domain Site Name: </td><td>" & net_client_site_name & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Domain Controller Address: </td><td>" & Replace(net_domain_controller_address, "\\", "") & "</td></tr>"
oIE.document.WriteLn "<tr><td>Domain Controller Name: </td><td>" & Replace(net_domain_controller_name, "\\", "") & "</td></tr>"
oIE.document.WriteLn "</table>"
oIE.document.WriteLn "</div>"
oIE.document.WriteLn "<br />"
oIE.document.WriteLn "<div id=""content"">"
oIE.document.WriteLn "<table border=""0"" cellpadding=""2"" cellspacing=""0"" class=""content"">"
oIE.document.WriteLn "<tr><td colspan=""2""><b>System Information</b></td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>User Name: </td><td>" & Replace(net_user_name, "\\", "\") & "</td></tr>"
oIE.document.WriteLn "<tr><td>Date Audited: </td><td>" & date & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Time Zone: </td><td>" & tm_zone & "</td></tr>"
oIE.document.WriteLn "<tr><td width=""250"">Registered Owner: </td><td>" & system_primary_owner_name & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>UUID: </td><td>" & system_uuid & "</td></tr>"
oIE.document.WriteLn "<tr><td>Model: </td><td>" & system_model & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Serial: </td><td>" & system_id_number & "</td></tr>"
oIE.document.WriteLn "<tr><td>Manufacturer: </td><td>" & trim(system_vendor) & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Chassis: </td><td>" & system_system_type & "</td></tr>"
oIE.document.WriteLn "</table></div>"
oIE.document.WriteLn "<br />"
oIE.document.WriteLn "<div id=""content"">"
oIE.document.WriteLn "<table border=""0"" cellpadding=""2"" cellspacing=""0"" class=""content"">"
oIE.document.WriteLn "<tr><td colspan=""2""><b>Windows Information</b></td></tr>"
oIE.document.WriteLn "<tr><td>OS Name: </td><td>" & OSName & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>OS Install Date: </td><td>" & OSInstall & "</td></tr>"
oIE.document.WriteLn "<tr><td>Registered User: </td><td>" & RegUser & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Registered Organisation: </td><td>" & RegOrg & "</td></tr>"
oIE.document.WriteLn "<tr><td>Country: </td><td>" & Country & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Language: </td><td>" & OSLang & "</td></tr>"
oIE.document.WriteLn "<tr><td>Serial Number: </td><td>" & SerNum & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Service Pack: </td><td>" & OSSerPack & "</td></tr>"
oIE.document.WriteLn "<tr><td>Windows Directory: </td><td>" & Country & "</td></tr>"
oIE.document.WriteLn "</table></div>"
oIE.document.WriteLn "<br style=""page-break-before:always;"" />"
oIE.document.WriteLn "<div id=""content"">"
oIE.document.WriteLn "<table border=""0"" cellpadding=""2"" cellspacing=""0"" class=""content"">"
oIE.document.WriteLn "<tr><td colspan=""2""><b>Hardware</b></td></tr>"
end if

'''''''''''''''''''''''''''
' Bios Information '
'''''''''''''''''''''''''''
comment = "Bios Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next

Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure",,48)
For Each objSMBIOS in colSMBIOS
bios_asset = objSMBIOS.SMBIOSAssetTag
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
form_input = "bios^^^" & clean(objItem.Description) _
& "^^^" & clean(objItem.Manufacturer) _
& "^^^" & clean(objItem.SerialNumber) _
& "^^^" & clean(objItem.SMBIOSBIOSVersion) _
& "^^^" & clean(objItem.Version) _
& "^^^" & clean(bios_asset) & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""
if online = "p" then
oIE.document.WriteLn "<tr><td>BIOS Manufacturer: </td><td>" & clean(objItem.Manufacturer) & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>BIOS Version: </td><td>" & clean(objItem.Version) & "</td></tr>"
end if
Next

'''''''''''''''''''''''''''
' Processor Information '
'''''''''''''''''''''''''''
comment = "Processor Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
count = 0
For Each objItem in colItems
count = count + 1
if count > int(system_num_processors) then
Exit For
end if
form_input = "processor^^^" & clean(objItem.Caption) & "^^^" & clean(objItem.CurrentClockSpeed) & "^^^" _
& clean(objItem.CurrentVoltage) & "^^^" & clean(objItem.DeviceID) & "^^^" _
& clean(objItem.ExtClock) & "^^^" & clean(objItem.Manufacturer) & "^^^" _
& clean(objItem.MaxClockSpeed) & "^^^" & LTrim(clean(objItem.Name)) & "^^^" _
& clean(objItem.PowerManagementSupported) & "^^^" & clean(objItem.SocketDesignation) & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""
if online = "p" then
oIE.document.WriteLn "<tr><td width=""250"">Processor: </td><td>" & clean(objItem.Caption) & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Processor Speed: </td><td>" & clean(objItem.MaxClockSpeed) & "</td></tr>"
end if
Next

'''''''''''''''''''''''''''
' Memory Information
'''''''''''''''''''''''''''
comment = "Memory Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
Set colItems = objWMIService.ExecQuery("Select MemoryDevices FROM Win32_PhysicalMemoryArray WHERE Use = '3'",,48)
For Each objItem in colItems
system_memory_banks = objItem.MemoryDevices
Next
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select Capacity,DeviceLocator,FormFactor,MemoryType,TypeDetail,Speed FROM Win32_PhysicalMemory",,48)
mem_count = 0
mem_size = 0

For Each objItem in colItems
mem_count = mem_count + 1

If mem_count > int(system_memory_banks) then
if verbose = "y" then
If blnCScript Then wscript.echo "mem_count: " & mem_count & " - system_memory_banks: " & int(system_memory_banks)
End If
Exit For
End If

If objItem.FormFactor = "7" then
mem_formfactor = "SIMM"
ElseIf objItem.FormFactor = "8" then
mem_formfactor = "DIMM"
ElseIf objItem.FormFactor = "11" then
mem_formfactor = "RIMM"
ElseIf objItem.FormFactor = "12" then
mem_formfactor = "SODIMM"
ElseIf objItem.FormFactor = "13" then
mem_formfactor = "SRIMM"
Else
mem_formfactor = "Unknown"
End If

If objItem.MemoryType = "0" then
mem_detail = "Unknown"
ElseIf objItem.MemoryType = "1" then
mem_detail = "Other"
ElseIf objItem.MemoryType = "2" then
mem_detail = "DRAM"
ElseIf objItem.MemoryType = "3" then
mem_detail = "Synchronous DRAM"
ElseIf objItem.MemoryType = "4" then
mem_detail = "Cache DRAM"
ElseIf objItem.MemoryType = "5" then
mem_detail = "EDO"
ElseIf objItem.MemoryType = "6" then
mem_detail = "EDRAM"
ElseIf objItem.MemoryType = "7" then
mem_detail = "VRAM"
ElseIf objItem.MemoryType = "8" then
mem_detail = "SRAM"
ElseIf objItem.MemoryType = "9" then
mem_detail = "RAM"
ElseIf objItem.MemoryType = "10" then
mem_detail = "ROM"
ElseIf objItem.MemoryType = "11" then
mem_detail = "Flash"
ElseIf objItem.MemoryType = "12" then
mem_detail = "EEPROM"
ElseIf objItem.MemoryType = "13" then
mem_detail = "FEPROM"
ElseIf objItem.MemoryType = "14" then
mem_detail = "EPROM"
ElseIf objItem.MemoryType = "15" then
mem_detail = "CDRAM"
ElseIf objItem.MemoryType = "16" then
mem_detail = "3DRAM"
ElseIf objItem.MemoryType = "17" then
mem_detail = "SDRAM"
ElseIf objItem.MemoryType = "18" then
mem_detail = "SGRAM"
ElseIf objItem.MemoryType = "19" then
mem_detail = "RDRAM"
ElseIf objItem.MemoryType = "20" then
mem_detail = "DDR"
End If

If objItem.TypeDetail = "1" then
mem_typedetail = "Reserved"
ElseIf objItem.TypeDetail = "2" then
mem_typedetail = "Other"
ElseIf objItem.TypeDetail = "4" then
mem_typedetail = "Unknown"
ElseIf objItem.TypeDetail = "8" then
mem_typedetail = "Fast-paged"
ElseIf objItem.TypeDetail = "16" then
mem_typedetail = "Static column"
ElseIf objItem.TypeDetail = "32" then
mem_typedetail = "Pseudo-static"
ElseIf objItem.TypeDetail = "64" then
mem_typedetail = "RAMBUS"
ElseIf objItem.TypeDetail = "128" then
mem_typedetail = "Synchronous"
ElseIf objItem.TypeDetail = "256" then
mem_typedetail = "CMOS"
ElseIf objItem.TypeDetail = "512" then
mem_typedetail = "EDO"
ElseIf objItem.TypeDetail = "1024" then
mem_typedetail = "Window DRAM"
ElseIf objItem.TypeDetail = "2048" then
mem_typedetail = "Cache DRAM"
ElseIf objItem.TypeDetail = "4096" then
mem_typedetail = "Non-volatile"
Else
mem_typedetail = "Unknown"
End If
mem_bank = objItem.DeviceLocator
mem_size = int(objItem.Capacity /1024 /1024)

form_input = "memory^^^" & mem_bank & "^^^" & mem_formfactor & "^^^" & mem_detail & "^^^" _
& mem_typedetail & "^^^" & mem_size & "^^^" & clean(objItem.Speed) & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""
if online = "p" then
oIE.document.WriteLn "<tr><td>Memory Slot / Type: </td><td>" & mem_bank & " / " & mem_detail & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Memory Size: </td><td>" & mem_size & "</td></tr>"
end if
Next

If mem_size = 0 Then
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)

For Each objItem in colItems
mem_size = objItem.TotalPhysicalMemory
Next
mem_size = int(mem_size /1024)

form_input = "memory^^^" & "Unknown" & "^^^" & "Unknown" & "^^^" & "Unknown" & "^^^" _
& "Unknown" & "^^^" & mem_size & "^^^" & "0" & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""

if online = "p" then
oIE.document.WriteLn "<tr><td>Memory Slot / Type: </td><td>" & mem_bank & " / " & mem_detail & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Memory Size: </td><td>" & mem_size & "</td></tr>"
end if
End If


'''''''''''''''''''''''''''
' Video Information '
'''''''''''''''''''''''''''
comment = "Video Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController",,48)
For Each objItem in colItems
If (Instr(objItem.Caption, "vnc") = 0 AND Instr(objItem.Caption, "Innobec SideWindow") = 0) then
LeftString = Left(objItem.DriverDate, 8)
form_input = "video^^^" & int(objItem.AdapterRAM / 1024 / 1024) & "^^^" _
& clean(objItem.Caption) & "^^^" & clean(objItem.CurrentHorizontalResolution) & "^^^" _
& clean(objItem.CurrentNumberOfColors) & "^^^" & clean(objItem.CurrentRefreshRate) & "^^^" _
& clean(objItem.CurrentVerticalResolution) & "^^^" & clean(objItem.Description) & "^^^" _
& Left(LeftString, 4) & "/" & Mid(LeftString, 5, 2) & "/" & Right(LeftString, 2) & "^^^" _
& clean(objItem.DriverVersion) & "^^^" & clean(objItem.MaxRefreshRate) & "^^^" _
& clean(objItem.MinRefreshRate) & "^^^" & clean(objItem.DeviceID) & "^^^"
entry form_input,comment,objTextFile,oAdd,oComment
form_input = ""
if online = "p" then
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Video Card: </td><td>" & clean(objItem.Caption) & " mb</td></tr>"
oIE.document.WriteLn "<tr><td>Video Memory: </td><td>" & int(objItem.AdapterRAM / 1024 / 1024) & "</td></tr>"
oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Video Driver Date: </td><td>" & Left(LeftString, 4) & "/" & Mid(LeftString, 5, 2) & "/" & Right(LeftString, 2) & "</td></tr>"
oIE.document.WriteLn "<tr><td>Video Driver Version: </td><td>" & clean(objItem.DriverVersion) & "</td></tr>"
end if
end if
Next


'''''''''''''''''''''''
' Monitor Information '
'''''''''''''''''''''''
comment = "Monitor Info"
if verbose = "y" then
If blnCScript Then wscript.echo comment
end if
Dim strarrRawEDID()
intMonitorCount=0
Const HKLM = &H80000002
sBaseKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY\"
iRC = oReg.EnumKey(HKLM, sBaseKey, arSubKeys)

For Each sKey In arSubKeys
sBaseKey2 = sBaseKey & sKey & "\"
iRC2 = oReg.EnumKey(HKLM, sBaseKey2, arSubKeys2)
For Each sKey2 In arSubKeys2
oReg.GetMultiStringValue HKLM, sBaseKey2 & sKey2 & "\", "HardwareID", sValue
for tmpctr=0 to ubound(svalue)
if lcase(left(svalue(tmpctr),8))="monitor\" then
sBaseKey3 = sBaseKey2 & sKey2 & "\"
iRC3 = oReg.EnumKey(HKLM, sBaseKey3, arSubKeys3)
For Each sKey3 In arSubKeys3
if skey3="Control" then
oReg.GetStringValue HKLM, sbasekey3, "DeviceDesc", temp_model
oReg.GetStringValue HKLM, sbasekey3, "Mfg", temp_manuf
oReg.GetBinaryValue HKLM, sbasekey3 & "Device Parameters\", "EDID", arrintEDID
if VarType(arrintedid) <> 8204 then
strRawEDID="EDID Not Available"
Else
for each bytevalue in arrintedid
strRawEDID=strRawEDID & chr(bytevalue)
Next
end If
redim Preserve strarrRawEDID(intMonitorCount)
strarrRawEDID(intMonitorCount)=strRawEDID
intMonitorCount=intMonitorCount+1
end If
Next
end If
Next
Next
Next

dim arrMonitorInfo()
redim arrMonitorInfo(intMonitorCount-1,5)
dim location(3)

'for tmpctr=0 to intMonitorCount-1
tmpctr=0
if strarrRawEDID(tmpctr) <> "EDID Not Available" then
location(0)=mid(strarrRawEDID(tmpctr),&H36+1,18)
location(1)=mid(strarrRawEDID(tmpctr),&H48+1,18)
location(2)=mid(strarrRawEDID(tmpctr),&H5a+1,18)
location(3)=mid(strarrRawEDID(tmpctr),&H6c+1,18)
strSerFind=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hff)
strMdlFind=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hfc)
intSerFoundAt=-1
intMdlFoundAt=-1
for findit = 0 to 3
if instr(location(findit),strSerFind)>0 then
intSerFoundAt=findit
end If
if instr(location(findit),strMdlFind)>0 then
intMdlFoundAt=findit
end If
Next
if intSerFoundAt<>-1 Then tmp=right(location(intSerFoundAt),14)
if instr(tmp,chr(&H0a))>0 Then
tmpser=trim(left(tmp,InStr(tmp,chr(&H0a))-1))
Else
tmpser=trim(tmp)
end If
if left(tmpser,1)=chr(0) Then
tmpser=right(tmpser,len(tmpser)-1)
Else
tmpser="Serial Number Not Found in EDID data"
end If
if intMdlFoundAt<>-1 Then tmp=right(location(intMdlFoundAt),14)
if instr(tmp,chr(&H0a))>0 Then
tmpmdl=trim(left(tmp,InStr(tmp,chr(&H0a))-1))
Else
tmpmdl=trim(tmp)
end If
if left(tmpmdl,1)=chr(0) Then
tmpmdl=right(tmpmdl,len(tmpmdl)-1)
Else
tmpmdl="Model Descriptor Not Found in EDID data"
end If
tmpmfgweek=asc(mid(strarrRawEDID(tmpctr),&H10+1,1))
tmpmfgyear=(asc(mid(strarrRawEDID(tmpctr),&H11+1,1)))+1990
tmpmdt=month(dateadd("ww",tmpmfgweek,datevalue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear
tmpEDIDMajorVer=asc(mid(strarrRawEDID(tmpctr),&H12+1,1))
tmpEDIDRev=asc(mid(strarrRawEDID(tmpctr),&H13+1,1))
tmpver=chr(48+tmpEDIDMajorVer) & "." & chr(48+tmpEDIDRev)
tmpEDIDMfg=mid(strarrRawEDID(tmpctr),&H08+1,2)
Char1=0 : Char2=0 : Char3=0
Byte1=asc(left(tmpEDIDMfg,1))
Byte2=asc(right(tmpEDIDMfg,1))
if (Byte1 and 64) > 0 then Char1=Char1+16
if (Byte1 and 32) > 0 then Char1=Char1+8
if (Byte1 and 16) > 0 then Char1=Char1+4
if (Byte1 and 8) > 0 then Char1=Char1+2
if (Byte1 and 4) > 0 then Char1=Char1+1
if (Byte1 and 2) > 0 then Char2=Char2+16
if (Byte1 and 1) > 0 then Char2=Char2+8
if (Byte2 and 128) > 0 then Char2=Char2+4
if (Byte2 and 64) &g

_________________
Server Info:
OS : Windows Server 2003
Auditing: ~300 machines
LDAP: Windows Server 2003 Active Directory


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group