'''''''''''''''''''''''''''''''''''
' Open Audit '
' Software and Hardware Inventory '
' (c) Open-Audit.org 2003-2009 '
' http://www.open-audit.org '
' Licensed under the AGPL v3 '
' http://www.fsf.org/licensing/licenses/agpl-3.0.html '
'''''''''''''''''''''''''''''''''''
start_time = Timer
' to do
'
' SHARES - get rmtshare.exe from OA server, if needed
' USB Attached Devices
' SCSI Devices
' Tape Information
' Floppy Drives
' Keyboard Information
' Battery Information
' Mouse Information
' Win32_LogicalShareSecuritySetting
' check differences between 5.6 and 5.7
' below are the default settings
' you will need to alter (at least) the 'url' variable for your environment
strComputer = "."
submit_online = "y"
create_file = "n"
url = "http://localhost/index.php/system"
use_proxy = "n"
strUser = ""
strPass = ""
org_id = ""
skip_mount_point = "n"
skip_printer = "y"
self_delete = "n"
debugging = "1"
' 0 = no debug
' 1 = basic debug
' 2 = verbose debug
' below we take any command line arguements
' to override the variables above, simply include them on the command line like submit_online=n
' NOTE - argurments are case sensitive
Set objArgs = WScript.Arguments
For Each strArg in objArgs
if instr(strArg, "=") then
argName = lcase(left(strArg,inStr(strArg,"=")-1))
argValue = mid(strArg,inStr(strArg,"=")+1)
select case argName
case "submit_online"
submit_online = argValue
case "create_file"
create_file = argValue
case "debugging"
debugging = argValue
case "org_id"
org_id = argValue
case "url"
url = argValue
case "use_proxy"
use_proxy = argValue
case "strcomputer"
strComputer = argvalue
case "skip_printer"
skip_printer = argvalue
case "skip_mount_point"
skip_mount_point = argvalue
case "struser"
strUser = argvalue
case "strpass"
strPass = argvalue
case "self_delete"
self_delete = argvalue
end select
else
strComputer = strArg
end if
Next
' start the script
if debugging > "0" then wscript.echo "starting audit - " & strComputer 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 FOR_READING = 1
const FOR_WRITING = 2
const FOR_APPENDING = 8
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Const ADS_SECURE_AUTHENTICATION = 1
Const ADS_USE_ENCRYPTION = 2
Dim objTrans, objDomain
if strUser <> "" then
' credentials passed, therefore assuming not a domain local PC.
Set wmiLocator = CreateObject("WbemScripting.SWbemLocator")
On Error Resume Next
Set wmiNameSpace = wmiLocator.ConnectServer(strComputer, "winmgmts:{impersonationLevel=Identify,authenticationLevel=Connect}!root\default", strUser, strPass, "", "", wbemConnectFlagUseMaxWait)
'Set wmiNameSpace = wmiLocator.ConnectServer(strComputer, "\root\default", strUser, strPass, "", "", wbemConnectFlagUseMaxWait)
'objSWbemServices.Security_.ImpersonationLevel = 6
wscript.echo err.number & " - " & err.description
wscript.quit
Set oReg = wmiNameSpace.Get("StdRegProv")
'Set objWMIService = wmiLocator.ConnectServer(strComputer, "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!root\cimv2",strUser,strPass, "", "", wbemConnectFlagUseMaxWait)
Set objWMIService = wmiLocator.ConnectServer(strComputer, "\root\cimv2",strUser,strPass, "", "", wbemConnectFlagUseMaxWait)
objWMIService.Security_.ImpersonationLevel = 3
'Set objWMIService2 = wmiLocator.ConnectServer(strComputer, "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\root\WMI",strUser,strPass, "", "", wbemConnectFlagUseMaxWait)
Set objWMIService2 = wmiLocator.ConnectServer(strComputer, "\root\WMI",strUser,strPass, "", "", wbemConnectFlagUseMaxWait)
objWMIService2.Security_.ImpersonationLevel = 3
else
' no credentials passed, therefore auditing as the user running this script
set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objWMIService2 = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
set objShell = CreateObject("WScript.Shell")
end if
set wshNetwork = WScript.CreateObject("WScript.Network")
local_hostname = wshNetwork.ComputerName
set objFSO = CreateObject("Scripting.FileSystemObject")
if ((strComputer = ".") or (strComputer = "127.0.0.1") or (lcase(strComputer) = lcase(local_hostname))) then
audit_location = "local"
else
audit_location = "remote"
end if
system_timestamp = Year(Now()) & "-" & Right("0" & Month(Now()),2) & "-" & Right("0" & Day(Now()),2) & " " & Right("0" & Hour(Now()),2) & ":" & Right("0" & Minute(Now()),2) & ":" & Right("0" & Second(Now()),2)
sCmpName= "." 'local computer
sScriptName = wscript.scriptName
for each oProc in getObject( "winmgmts:{impersonationLevel=impersonate}!\\" & sCmpName & "\root\cimv2").instancesOf("Win32_Process")
if lcase(oProc.name) = "wscript.exe" _
or lcase(oProc.name) = "cscript.exe" Then
sCmdLine = oProc.commandLine
if instr(1, sCmdLine, "\" & sScriptName, vbTextCompare) > 0 _
or instr(1, sCmdLine, " " & sScriptName, vbTextCompare) > 0 _
or instr(1, sCmdLine, """" & sScriptName, vbTextCompare) > 0 then
nPID = oProc.processId
end if
end if
next
if debugging > "0" then wscript.echo "My PID is : " & nPID end if
if debugging > "0" then wscript.echo "Audit Start Time : " & system_timestamp end if
if debugging > "0" then wscript.echo "Audit Location: " & audit_location end if
if debugging > "0" then wscript.echo "-------------------" end if
if debugging > "0" then wscript.echo "system info" end if
set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
for each objItem in colItems
system_os_version = objItem.Version
windows_build_number = objItem.BuildNumber
windows_service_pack = objItem.ServicePackMajorVersion
system_os_family = os_family(objItem.Caption)
system_os_name = objItem.Caption
system_os_icon = lcase(system_os_name)
system_os_icon = replace(system_os_icon, " ", "_")
system_description = LCase(objItem.Description)
OSInstall = objItem.InstallDate
OSInstall = Left(OSInstall, 8)
OSInstallYear = Left(OSInstall, 4)
OSInstallMonth = Mid(OSInstall, 5, 2)
OSInstallDay = Right(OSInstall, 2)
system_pc_date_os_installation = OSInstallYear & "-" & OSInstallMonth & "-" & OSInstallDay
windows_boot_device = objItem.BootDevice
windows_country_code = WMIOSCountry(objItem.CountryCode)
windows_organisation = objItem.Organization
windows_language = WMIOSLanguage(objItem.OSLanguage)
windows_registered_user = objItem.RegisteredUser
windows_install_directory_split = split(objItem.Name, "|")
windows_install_directory = windows_install_directory_split(1)
next
mem_size = 0
system_pc_memory = 0
set colItems = objWMIService.ExecQuery("Select Capacity,DeviceLocator,FormFactor,MemoryType,TypeDetail,Speed,Tag FROM Win32_PhysicalMemory",,48)
for each objItem in colItems
mem_size = int(objItem.Capacity /1024)
system_pc_memory = system_pc_memory + mem_size
next
set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
for each objItem in colItems
system_hostname = LCase(objItem.Name)
system_domain = LCase(objItem.Domain)
system_pc_num_processor = 0
on error resume next
system_pc_num_processor = objItem.NumberOfLogicalProcessors
on error goto 0
if (system_pc_num_processor = 0) then
system_pc_num_processor = objItem.NumberOfProcessors
end if
system_model = objItem.Model
windows_domain_role = objItem.DomainRole
' below only checks when OS is XP or later (not 2000 or NT)
if (windows_build_number > 2195) then
windows_part_of_domain = objItem.PartOfDomain
end if
next
' last logged on user
oreg.getstringvalue hkey_local_machine, "software\microsoft\windows nt\currentversion\winlogon", "DefaultUserName", windows_user_name
oreg.getstringvalue hkey_local_machine, "software\microsoft\windows nt\currentversion\winlogon", "DefaultDomainName", windows_user_domain
if (instr(windows_user_name, "\")) then
split_user = split(windows_user_name, "\")
windows_user_name = split_user(1)
if ((isnull(windows_user_domain) or (windows_user_domain = "")) and (split_user(0) > "")) then
windows_user_domain = split_user(0)
end if
end if
if (isnull(windows_user_domain)) then
windows_user_domain = ""
else
windows_user_domain = "@" & lcase(windows_user_domain)
end if
if (isnull(windows_user_name) or (windows_user_name = ""))then
' likely a Win7 or Win2008 machine
oreg.getstringvalue hkey_local_machine, "software\microsoft\windows\currentversion\authentication\logonui", "lastloggedonuser", windows_user_name
if isnull(windows_user_name) then
oreg.getstringvalue hkey_local_machine, "software\microsoft\windows\currentversion\authentication\logonui", "lastloggedonsamuser", windows_user_name
if isnull(windows_user_name) then
windows_user_name = ""
end if
else
if (instr(windows_user_name, "\")) then
name = split(windows_user_name, "\")
windows_user_name = lcase(name(1)) & "@" & lcase(name(0))
else
windows_user_name = lcase(windows_user_name) & lcase(windows_user_domain)
end if
end if
else
windows_user_name = lcase(windows_user_name) & lcase(windows_user_domain)
end if
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)
for each objItem in colItems
system_serial = objItem.IdentifyingNumber
system_manufacturer = objItem.Vendor
system_uuid = objItem.UUID
windows_id_number = objItem.IdentifyingNumber
next
set colItems = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure",,48)
for each objItem in colItems
system_form_factor = form_factor(Join(objItem.ChassisTypes, ","))
next
' using "on error" because am getting some errors - breaking the script.
' occuring on Windows XP machines.
on error resume next
Set colItems = objWMIService.ExecQuery("Select * From Win32_PerfFormattedData_PerfOS_System",,48)
For Each objItem in colItems
system_uptime = objItem.SystemUpTime
Next
on error goto 0
' NOTE - we use the processor address width to determine if we are running 32bit or 64bit Windows
set colItems = objWMIService.ExecQuery("Select AddressWidth from Win32_Processor where DeviceID='CPU0'",,48)
for each objItem In colItems
address_width = objItem.AddressWidth
next
'wscript.echo "Address Width: " & address_width
'result = "" & vbcrlf
result = "" & vbcrlf
result = result & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_timestamp) & "" & vbcrlf
result = result & " " & escape_xml(system_uuid) & "" & vbcrlf
result = result & " " & escape_xml(system_hostname) & "" & vbcrlf
result = result & " " & escape_xml(system_domain) & "" & vbcrlf
result = result & " " & escape_xml(system_description) & "" & vbcrlf
result = result & " system" & vbcrlf
result = result & " " & system_os_icon & "" & vbcrlf
result = result & " Windows" & vbcrlf
result = result & " " & escape_xml(system_os_family) & "" & vbcrlf
result = result & " " & escape_xml(system_os_name) & "" & vbcrlf
result = result & " " & escape_xml(system_os_version) & "" & vbcrlf
result = result & " " & escape_xml(system_serial) & "" & vbcrlf
result = result & " " & escape_xml(system_model) & "" & vbcrlf
result = result & " " & escape_xml(system_manufacturer) & "" & vbcrlf
result = result & " " & escape_xml(system_uptime) & "" & vbcrlf
result = result & " " & escape_xml(system_form_factor) & "" & vbcrlf
result = result & " " & escape_xml(address_width) & "" & vbcrlf
result = result & " " & escape_xml(system_pc_memory) & "" & vbcrlf
result = result & " " & escape_xml(system_pc_num_processor) & "" & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " " & escape_xml(org_id) & "" & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "windows info" end if
if windows_domain_role = "0" then windows_domain_role = "Standalone Workstation" end if
if windows_domain_role = "1" then windows_domain_role = "Workstation" end if
if windows_domain_role = "2" then windows_domain_role = "Standalone Server" end if
if windows_domain_role = "3" then windows_domain_role = "Member Server" end if
if windows_domain_role = "4" then windows_domain_role = "Backup Domain Controller" end if
if windows_domain_role = "5" then windows_domain_role = "Primary Domain Controller" end if
error = 0
if windows_part_of_domain = "True" then
' Get domain NetBIOS name from domain DNS name
domain_dn = "DC=" & Replace(system_domain,".",",DC=")
set oTranslate = CreateObject("NameTranslate")
hr = oTranslate.Init (3, "")
hr = oTranslate.set (1, domain_dn)
full_ad_domain = oTranslate.Get(1)
full_domain = oTranslate.Get(2)
domain_nb = oTranslate.Get(3)
domain_nb = Left(domain_nb,Len(domain_nb)-1)
set colItems = objWMIService.ExecQuery("Select * from Win32_NTDomain WHERE DomainName='" & domain_nb & "'",,48)
for each objItem in colItems
windows_client_site_name = objItem.ClientSiteName
windows_domain_controller_address = replace(objItem.DomainControllerAddress, "\\", "")
windows_domain_controller_name = replace(objItem.DomainControllerName, "\\", "")
next
' windows_active_directory_ou = ConvertComputerName2ADSPath(system_hostname)
' windows_active_directory_ou = Mid(windows_active_directory_ou, InStr(windows_active_directory_ou, ",")+1, len(windows_active_directory_ou))
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 distinguishedName, name from 'GC://" & full_ad_domain & "' where objectclass = 'computer' and Name = '" & system_hostname & "'"
objcommand.properties("page size") = 1000
objcommand.properties("searchscope") = ads_scope_subtree
objcommand.properties("sort on") = "name"
set objrecordset = objcommand.execute
on error resume next
objrecordset.movefirst
if err.number <> 0 then
error = 1
end if
do until objrecordset.eof
windows_active_directory_ou = objrecordset.fields("distinguishedName").value
objrecordset.movenext
loop
on error goto 0
if error = 1 then
' we failed when using GC:// - try using LDAP://
error = 0
objcommand.commandtext = "select distinguishedName, name from 'LDAP://" & full_ad_domain & "' where objectclass = 'computer' and Name = '" & system_hostname & "'"
set objrecordset = objcommand.execute
on error resume next
objrecordset.movefirst
if err.number <> 0 then
error = 1
end if
do until objrecordset.eof
windows_active_directory_ou = objrecordset.fields("distinguishedName").value
objrecordset.movenext
loop
on error goto 0
end if
if error = 1 then
windows_active_directory_ou = full_ad_domain
end if
stemp = split(windows_active_directory_ou, ",")
stemp(0) = ""
ttemp = join(stemp, ",")
ttemp = mid(ttemp, 2)
windows_active_directory_ou = ttemp
erase stemp
ttemp = NULL
else
domain_nb = "workgroup"
windows_client_site_name = ""
windows_domain_controller_address = ""
windows_domain_controller_name = ""
windows_active_directory_ou = ""
end if
if windows_part_of_domain = "True" then
if (instr(windows_user_name, "@")) then
split_user = split(windows_user_name, "@")
sam_account_name = split_user(0)
windows_user_domain = split_user(1)
else
sam_account_name = windows_user_name
windows_user_domain = ""
end if
strUserDN = ""
if (windows_user_domain > "") then
on error resume next
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, windows_user_domain & "\" & sam_account_name
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
strUserDN = Replace(strUserDN, "/", "\/")
stemp = split(strUserDN, ",")
stemp(0) = ""
ttemp = join(stemp, ",")
ttemp = mid(ttemp, 2)
strUserDN = ttemp
erase stemp
ttemp = NULL
on error goto 0
else
strUserDN = ""
end if
windows_user_company = windows_user_get_attribute (strUserDN, "company", sam_account_name)
if lcase(windows_user_company) = "corporate and executive services" then
windows_user_company = windows_user_get_attribute (strUserDN, "department", sam_account_name)
end if
if lcase(windows_user_company) = "qbuild" then
windows_user_company = windows_user_get_attribute (strUserDN, "physicalDeliveryOfficeName", sam_account_name)
end if
windows_user_name = windows_user_name & " (" & windows_user_company & ")"
end if
function windows_user_get_attribute (full_ad_domain, attribute, sam_account_name)
if (full_ad_domain > "") 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, " & attribute & " from 'GC://" & full_ad_domain & "' where objectCategory = 'person' and sAMAccountName = '" & sam_account_name & "'"
'wscript.echo objcommand.commandtext
objcommand.properties("page size") = 1000
objcommand.properties("searchscope") = ads_scope_subtree
objcommand.properties("sort on") = "name"
set objrecordset = objcommand.execute
objrecordset.movefirst
do until objrecordset.eof
windows_user_get_attribute = objrecordset.fields(attribute).value
objrecordset.movenext
loop
if windows_user_get_attribute = "" then
'wscript.echo "no user data"
windows_user_get_attribute = ""
end if
if isnull(windows_user_get_attribute) then
'wscript.echo "user data is null"
windows_user_get_attribute = ""
end if
else
windows_user_get_attribute = ""
end if
end function
set colItems = objWMIService.ExecQuery("Select * from Win32_TimeZone",,48)
for each objItem in colItems
windows_time_caption = objItem.Caption
windows_time_daylight = objItem.DaylightName
next
result = result & " " & vbcrlf
result = result & " " & escape_xml(windows_build_number) & "" & vbcrlf
result = result & " " & escape_xml(lcase(windows_user_name)) & "" & vbcrlf
result = result & " " & escape_xml(windows_client_site_name) & "" & vbcrlf
result = result & " " & escape_xml(domain_nb) & "" & vbcrlf
result = result & " " & escape_xml(windows_domain_controller_address) & "" & vbcrlf
result = result & " " & escape_xml(windows_domain_controller_name) & "" & vbcrlf
result = result & " " & escape_xml(windows_domain_role) & "" & vbcrlf
result = result & " " & escape_xml(windows_part_of_domain) & "" & vbcrlf
result = result & " " & escape_xml(windows_id_number) & "" & vbcrlf
result = result & " " & escape_xml(windows_time_caption) & "" & vbcrlf
result = result & " " & escape_xml(windows_time_daylight) & "" & vbcrlf
result = result & " " & escape_xml(windows_boot_device) & "" & vbcrlf
result = result & " " & escape_xml(windows_country_code) & "" & vbcrlf
result = result & " " & escape_xml(windows_organisation) & "" & vbcrlf
result = result & " " & escape_xml(windows_language) & "" & vbcrlf
result = result & " " & escape_xml(windows_registered_user) & "" & vbcrlf
result = result & " " & escape_xml(windows_service_pack) & "" & vbcrlf
result = result & " " & escape_xml(system_os_version) & "" & vbcrlf
result = result & " " & escape_xml(windows_install_directory) & "" & vbcrlf
result = result & " " & escape_xml(lcase(windows_active_directory_ou)) & "" & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "bios info" end if
item = ""
set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS",,48)
for each objItem in colItems
item = item & " " & escape_xml(objItem.Description) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(objItem.SerialNumber) & "" & vbcrlf
item = item & " " & escape_xml(objItem.SMBIOSBIOSVersion) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Version) & "" & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "scsi info" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_SCSIController",,48)
for each objItem in colItems
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(objItem.PNPDeviceID) & "" & vbcrlf
item = item & " other" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "processor info" end if
newpath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
newkey = "ProcessorNameString"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
processor_description = strValue
set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
for each objItem In colItems
' NOTE - processor_description taken from registry (above)
' WMI does not seem to update when the processor is changed
' think virtualising a physical machine
'processor_description = objItem.Name
processor_speed = objItem.MaxClockSpeed
processor_manufacturer = objItem.Manufacturer
processor_power_management_supported = objItem.PowerManagementSupported
select case objItem.UpgradeMethod
case "1" cpu_socket = "Other"
case "2" cpu_socket = "Unknown"
case "3" cpu_socket = "Daughter Board"
case "4" cpu_socket = "ZIF Socket"
case "5" cpu_socket = "Replacement or Piggy Back"
case "6" cpu_socket = "None"
case "7" cpu_socket = "LIF Socket"
case "8" cpu_socket = "Slot 1"
case "9" cpu_socket = "Slot 2"
case "10" cpu_socket = "370 Pin Socket"
case "11" cpu_socket = "Slot A"
case "12" cpu_socket = "Slot M"
case "13" cpu_socket = "Socket 423"
case "14" cpu_socket = "Socket A (462)"
case "15" cpu_socket = "Socket 478"
case "16" cpu_socket = "Socket 754"
case "17" cpu_socket = "Socket 940"
case "18" cpu_socket = "Socket 939"
case "21" cpu_socket = "Socket 775"
case Default cpu_socket = "Unknown"
end select
next
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_num_processor) & "" & vbcrlf
result = result & " " & escape_xml(cpu_socket) & "" & vbcrlf
result = result & " " & escape_xml(processor_description) & "" & vbcrlf
result = result & " " & escape_xml(processor_speed) & "" & vbcrlf
result = result & " " & escape_xml(processor_manufacturer) & "" & vbcrlf
result = result & " " & escape_xml(processor_power_management_supported) & "" & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "memory info" end if
memory = ""
set colItems = objWMIService.ExecQuery("Select Capacity,DeviceLocator,FormFactor,MemoryType,TypeDetail,Speed,Tag FROM Win32_PhysicalMemory",,48)
for each objItem in colItems
select case objItem.FormFactor
case "1" mem_formfactor = "Other"
case "2" mem_formfactor = "SIP"
case "3" mem_formfactor = "DIP"
case "4" mem_formfactor = "ZIP"
case "5" mem_formfactor = "SOJ"
case "6" mem_formfactor = "Proprietary"
case "7" mem_formfactor = "SIMM"
case "8" mem_formfactor = "DIMM"
case "9" mem_formfactor = "TSOP"
case "10" mem_formfactor = "PGA"
case "11" mem_formfactor = "RIMM"
case "12" mem_formfactor = "SODIMM"
case "13" mem_formfactor = "SRIMM"
case "14" mem_formfactor = "SMD"
case "15" mem_formfactor = "SSMP"
case "16" mem_formfactor = "QFP"
case "17" mem_formfactor = "TQFP"
case "18" mem_formfactor = "SOIC"
case "19" mem_formfactor = "LCC"
case "20" mem_formfactor = "PLCC"
case "21" mem_formfactor = "BGA"
case "22" mem_formfactor = "FPBGA"
case "23" mem_formfactor = "LGA"
case else mem_formfactor = "Unknown"
end select
select case objItem.MemoryType
case "0" mem_detail = "Unknown"
case "1" mem_detail = "Other"
case "2" mem_detail = "DRAM"
case "3" mem_detail = "Synchronous DRAM"
case "4" mem_detail = "Cache DRAM"
case "5" mem_detail = "EDO"
case "6" mem_detail = "EDRAM"
case "7" mem_detail = "VRAM"
case "8" mem_detail = "SRAM"
case "9" mem_detail = "RAM"
case "10" mem_detail = "ROM"
case "11" mem_detail = "Flash"
case "12" mem_detail = "EEPROM"
case "13" mem_detail = "FEPROM"
case "14" mem_detail = "EPROM"
case "15" mem_detail = "CDRAM"
case "16" mem_detail = "3DRAM"
case "17" mem_detail = "SDRAM"
case "18" mem_detail = "SGRAM"
case "19" mem_detail = "RDRAM"
case "20" mem_detail = "DDR"
case "21" mem_detail = "DDR-2"
case else mem_detail = "Unknown"
end select
select case objItem.TypeDetail
case "1" mem_typedetail = "Reserved"
case "2" mem_typedetail = "Other"
case "4" mem_typedetail = "Unknown"
case "8" mem_typedetail = "Fast-paged"
case "16" mem_typedetail = "Static column"
case "32" mem_typedetail = "Pseudo-static"
case "64" mem_typedetail = "RAMBUS"
case "128" mem_typedetail = "Synchronous"
case "256" mem_typedetail = "CMOS"
case "512" mem_typedetail = "EDO"
case "1024" mem_typedetail = "Window DRAM"
case "2048" mem_typedetail = "Cache DRAM"
case "4096" mem_typedetail = "Non-volatile"
case else mem_typedetail = "Unknown"
end select
mem_bank = objItem.DeviceLocator
mem_size = int(objItem.Capacity /1024 /1024)
mem_speed = objItem.Speed
mem_tag = objItem.Tag
memory = memory & " " & vbcrlf
memory = memory & " " & escape_xml(mem_bank) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_typedetail) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_formfactor) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_detail) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_size) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_speed) & "" & vbcrlf
memory = memory & " " & escape_xml(mem_tag) & "" & vbcrlf
memory = memory & " " & vbcrlf
next
if memory > "" then
result = result & " " & vbcrlf
result = result & memory
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "motherboard info" end if
set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard",,48)
for each objItem in colItems
mb_manufacturer = objItem.Manufacturer
mb_model = objItem.Product
mb_serial = objItem.SerialNumber
next
' Counting CPU sockets
set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor",,48)
CpuSockets = 0
for each objItem In colItems
if Instr(SocketDesignation, objItem.SocketDesignation) = 0 then
mb_cpu_sockets = CpuSockets + 1
end if
next
' Counting RAM slots
set colItems = objWMIService.ExecQuery("Select MemoryDevices FROM Win32_PhysicalMemoryArray ",,48)
for each objItem in colItems
mb_memory_slots = objItem.MemoryDevices
next
result = result & " " & vbcrlf
result = result & " " & escape_xml(mb_manufacturer) & "" & vbcrlf
result = result & " " & escape_xml(mb_model) & "" & vbcrlf
result = result & " " & escape_xml(mb_serial) & "" & vbcrlf
result = result & " " & escape_xml(mb_cpu_sockets) & "" & vbcrlf
result = result & " " & escape_xml(cpu_socket) & "" & vbcrlf
result = result & " " & escape_xml(mb_memory_slots) & "" & vbcrlf
result = result & " " & vbcrlf
' using "on error" because of a Windows bug - see http://support.microsoft.com/kb/823778
if debugging > "0" then wscript.echo "optical info" end if
item = ""
on error resume next
set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive",,48)
for each objItem in colItems
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.Caption) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Caption) & "" & vbcrlf
item = item & " " & escape_xml(objItem.DeviceID) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Drive) & "" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
on error goto 0
if debugging > "0" then wscript.echo "modem info" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_POTSModem where status='OK' ",,48)
for each objItem in colItems
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.AttachedTo) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Model) & "" & vbcrlf
item = item & " " & escape_xml(objItem.CountrySelected) & "" & vbcrlf
item = item & " " & escape_xml(objItem.DeviceID) & "" & vbcrlf
item = item & " " & escape_xml(objItem.DeviceType) & "" & vbcrlf
item = item & " " & escape_xml(objItem.ProviderName) & "" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "video info" end if
item = ""
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 AND Instr(objItem.Caption, "Microsoft SMS Mirror Driver") = 0) then
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.AdapterCompatibility) & "" & vbcrlf
item = item & " " & escape_xml(int(objItem.AdapterRAM /1024 /1024)) & "" & vbcrlf
' device_id = objItem.PNPDeviceID
' query = "Select * from Win32_PnPSignedDriver where DeviceID = '" & device_id & "'"
' wscript.echo query
' set colItems2 = objWMIService.ExecQuery(query,,48)
' for each objItem2 in colItems2
' driver_date = CDate(Mid(objItem2.DriverDate, 5, 2) & "/" & Mid(objItem2.DriverDate, 7, 2) & "/" & Left(objItem2.DriverDate, 4) & " " & Mid (objItem2.DriverDate, 9, 2) & ":" & Mid(objItem2.DriverDate, 11, 2) & ":" & Mid(objItem2.DriverDate,13, 2))
' driver_version = objItem2.DriverVersion
' item = item & " " & escape_xml(driver_date) & "" & vbcrlf
' item = item & " " & escape_xml(driver_version) & "" & vbcrlf
' next
item = item & " " & vbcrlf
end if
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "monitor info" end if
' note we exclude "monitors" that are plug'n'play types and have no real info
item = ""
dim strarrRawEDID(10)
dim temp_model(10)
dim temp_manuf(10)
intMonitorCount=0
sBaseKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY\"
iRC = oReg.EnumKey(HKEY_LOCAL_MACHINE, sBaseKey, arSubKeys)
if (isnull(arSubKeys)) then
' do nothing
else
for each sKey In arSubKeys
sBaseKey2 = sBaseKey & sKey & "\"
iRC2 = oReg.EnumKey(HKEY_LOCAL_MACHINE, sBaseKey2, arSubKeys2)
for each sKey2 In arSubKeys2
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE, sBaseKey2 & sKey2 & "\", "HardwareID", sValue
for tmpctr=0 to ubound(svalue)
if lcase (left(svalue(tmpctr),8))="monitor\" then
sBaseKey3 = sBaseKey2 & sKey2 & "\"
iRC3 = oReg.EnumKey(HKEY_LOCAL_MACHINE, sBaseKey3, arSubKeys3)
for each sKey3 In arSubKeys3
if skey3="Control" then
strRawEDID = ""
oReg.GetStringValue HKEY_LOCAL_MACHINE, sbasekey3, "DeviceDesc", temp_model(intMonitorCount)
oReg.GetStringValue HKEY_LOCAL_MACHINE, sbasekey3, "Mfg", temp_manuf(intMonitorCount)
oReg.GetBinaryValue HKEY_LOCAL_MACHINE, 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)
item = ""
tmpctr = 0
all_device_id = ""
for tmpctr = 0 to intMonitorCount-1
manufacturer = ""
device_id = ""
manufacture_date = ""
serial = ""
model = ""
edid_version = ""
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
' serial
serial = ""
tmp = ""
if intSerFoundAt <> -1 then tmp = right(location(intSerFoundAt),14)
if instr(tmp,chr(&H0a)) > 0 then
serial = trim(left(tmp,InStr(tmp,chr(&H0a))-1))
else
serial = trim(tmp)
end if
if left(serial,1) = chr(0) then
serial = right(serial,len(serial)-1)
else
serial = "Serial Number Not Found in EDID data"
end if
if serial = "" then serial = "Serial Number Not Found in EDID data"
' model
model = ""
tmp = ""
if intMdlFoundAt <> -1 then tmp = right(location(intMdlFoundAt),14)
if instr(tmp,chr(&H0a)) > 0 then
model = trim(left(tmp,InStr(tmp,chr(&H0a))-1))
else
model = trim(tmp)
end if
if left(model,1) = chr(0) then
model = right(model,len(model)-1)
else
model = "Model Descriptor Not Found in EDID data"
end if
if (model = "Model Descriptor Not Found in EDID data" AND temp_model(tmpctr) <> "") then model = temp_model(tmpctr) end if
if (model = "" AND temp_model(tmpctr) <> "") then model = temp_model(tmpctr) end if
if (model = "" AND temp_model(tmpctr) = "") then model = "Model Descriptor Not Found in EDID data"
model = escape(model)
model = replace(model, "%00", "")
model = unescape(model)
' manufacture date
tmpmfgweek = asc(mid(strarrRawEDID(tmpctr),&H10+1,1))
tmpmfgyear = (asc(mid(strarrRawEDID(tmpctr),&H11+1,1))) + 1990
manufacture_date = month(dateadd("ww",tmpmfgweek,datevalue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear
' Inserts a 0 if month < 10
temp_date = Split(manufacture_date, "/", -1, 1)
temp_date(0) = right("0" & temp_date(0),2)
manufacture_date = temp_date(0) & "/" & temp_date(1)
'edid version
tmpEDIDMajorVer = asc(mid(strarrRawEDID(tmpctr),&H12+1,1))
tmpEDIDRev = asc(mid(strarrRawEDID(tmpctr),&H13+1,1))
edid_version = chr(48+tmpEDIDMajorVer) & "." & chr(48+tmpEDIDRev)
'device id
tmpEDIDDev1 = hex(asc(mid(strarrRawEDID(tmpctr),&H0a+1,1)))
tmpEDIDDev2 = hex(asc(mid(strarrRawEDID(tmpctr),&H0b+1,1)))
if len(tmpEDIDDev1) = 1 then tmpEDIDDev1 = "0" & tmpEDIDDev1 end if
if len(tmpEDIDDev2) = 1 then tmpEDIDDev2 = "0" & tmpEDIDDev2 end if
device_id = tmpEDIDDev2 & tmpEDIDDev1
' manufacturer
manufacturer = ""
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) > 0 then Char2 = Char2 + 2
if (Byte2 and 32) > 0 then Char2 = Char2 + 1
Char3 = Char3 + (Byte2 and 16)
Char3 = Char3 + (Byte2 and 8)
Char3 = Char3 + (Byte2 and 4)
Char3 = Char3 + (Byte2 and 2)
Char3 = Char3 + (Byte2 and 1)
man_id = chr(Char1+64) & chr(Char2+64) & chr(Char3+64)
std_mon = instr(temp_manuf(tmpctr), "(Standard monitor types)")
if ( std_mon = 0 AND temp_manuf(tmpctr) <> "" ) then man_id = temp_manuf(tmpctr)
manufacturer = man_id
if (man_id = "ACR") then manufacturer = "Acer" end if
if (man_id = "ACT") then manufacturer = "Targa" end if
if (man_id = "ADI") then manufacturer = "ADI" end if
if (man_id = "AOC") then manufacturer = "AOC International" end if
if (man_id = "API") then manufacturer = "Acer" end if
if (man_id = "APP") then manufacturer = "Apple" end if
if (man_id = "ART") then manufacturer = "ArtMedia" end if
if (man_id = "AST") then manufacturer = "AST Research" end if
if (man_id = "CPL") then manufacturer = "Compal" end if
if (man_id = "CPQ") then manufacturer = "Compaq" end if
if (man_id = "CTX") then manufacturer = "Chuntex" end if
if (man_id = "DEC") then manufacturer = "Digital Equipment Corporation" end if
if (man_id = "DEL") then manufacturer = "Dell" end if
if (man_id = "Dell Inc.") then manufacturer = "Dell" end if
if (man_id = "DPC") then manufacturer = "Delta" end if
if (man_id = "DWE") then manufacturer = "Daewoo" end if
if (man_id = "ECS") then manufacturer = "Elitegroup Computer Systems" end if
if (man_id = "EIZ") then manufacturer = "EIZO" end if
if (man_id = "EPI") then manufacturer = "Envision" end if
if (man_id = "FCM") then manufacturer = "Funai" end if
if (man_id = "FUS") then manufacturer = "Fujitsu Siemens" end if
if (man_id = "GSM") then manufacturer = "LG Electronics" end if
if (man_id = "GWY") then manufacturer = "Gateway 2000" end if
if (man_id = "HEI") then manufacturer = "Hyundai" end if
if (man_id = "HIT") then manufacturer = "Hitachi" end if
if (man_id = "HSD") then manufacturer = "Hanns.G" end if
if (man_id = "HSL") then manufacturer = "Hansol Electronics" end if
if (man_id = "HTC") then manufacturer = "Hitachi" end if
if (man_id = "HWP") then manufacturer = "Hewlett Packard" end if
if (man_id = "IBM") then manufacturer = "IBM" end if
if (man_id = "ICL") then manufacturer = "Fujitsu" end if
if (man_id = "IVM") then manufacturer = "Idek Iiyama" end if
if (man_id = "KFC") then manufacturer = "KFC Computek" end if
if (man_id = "LEN") then manufacturer = "Lenovo" end if
if (man_id = "LGD") then manufacturer = "LG Display" end if
if (man_id = "LKM") then manufacturer = "ADLAS / AZALEA" end if
if (man_id = "LNK") then manufacturer = "LINK Technologies" end if
if (man_id = "LTN") then manufacturer = "Lite-On" end if
if (man_id = "MAG") then manufacturer = "MAG InnoVision" end if
if (man_id = "MAX") then manufacturer = "Maxdata Computer" end if
if (man_id = "MEI") then manufacturer = "Panasonic" end if
if (man_id = "MEL") then manufacturer = "Mitsubishi Electronics" end if
if (man_id = "MIR") then manufacturer = "Miro" end if
if (man_id = "MTC") then manufacturer = "MITAC" end if
if (man_id = "NAN") then manufacturer = "NANAO" end if
if (man_id = "NEC") then manufacturer = "NEC" end if
if (man_id = "NOK") then manufacturer = "Nokia" end if
if (man_id = "OQI") then manufacturer = "Optiquest" end if
if (man_id = "PBN") then manufacturer = "Packard Bell" end if
if (man_id = "PGS") then manufacturer = "Princeton Graphic Systems" end if
if (man_id = "PHL") then manufacturer = "Philips" end if
if (man_id = "PNP") then manufacturer = "Plug n Play (Microsoft)" end if
if (man_id = "REL") then manufacturer = "Relisys" end if
if (man_id = "SAM") then manufacturer = "Samsung" end if
if (man_id = "SMI") then manufacturer = "Smile" end if
if (man_id = "SMC") then manufacturer = "Samtron" end if
if (man_id = "SNI") then manufacturer = "Siemens Nixdorf" end if
if (man_id = "SNY") then manufacturer = "Sony Corporation" end if
if (man_id = "SPT") then manufacturer = "Sceptre" end if
if (man_id = "SRC") then manufacturer = "Shamrock Technology" end if
if (man_id = "STN") then manufacturer = "Samtron" end if
if (man_id = "STP") then manufacturer = "Sceptre" end if
if (man_id = "TAT") then manufacturer = "Tatung" end if
if (man_id = "TRL") then manufacturer = "Royal Information Company" end if
if (man_id = "TOS") then manufacturer = "Toshiba" end if
if (man_id = "TSB") then manufacturer = "Toshiba" end if
if (man_id = "UNM") then manufacturer = "Unisys" end if
if (man_id = "VSC") then manufacturer = "ViewSonic" end if
if (man_id = "WTC") then manufacturer = "Wen Technology" end if
if (man_id = "ZCM") then manufacturer = "Zenith Data Systems" end if
if (man_id = "___") then manufacturer = "Targa"
screen_size = round((sqr((asc(mid(strarrRawEDID(tmpctr),22,1)) * asc(mid(strarrRawEDID(tmpctr),22,1))) + (asc(mid(strarrRawEDID(tmpctr),23,1)) * asc(mid(strarrRawEDID(tmpctr),23,1)))) * 10 / 25.4), 1)
'wscript.echo "Screen Size: " & screen_size
'for i = 35 to 37
' wscript.echo "Ratio " & i & ": " & asc(mid(strarrRawEDID(tmpctr),i,1))
'next
ratio = ""
if (asc(mid(strarrRawEDID(tmpctr),38,1)) and 128) then ratio = "1:" else ratio = "0:"
if (asc(mid(strarrRawEDID(tmpctr),38,1)) and 64) then ratio = ratio & "1" else ratio = ratio & "0"
if ratio = "0:0" then ratio = "16:10"
if ratio = "0:1" then ratio = "4:3"
if ratio = "1:0" then ratio = "5:4"
if ratio = "1:1" then ratio = "16:9"
if (instr(all_device_id, device_id) = 0) then
' we don't have this device_id already, so output this entry
' note we exclude "monitors" that are plug'n'play types and have no real info
if (manufacturer <> "" and _
manufacture_date <> "01/1990" and _
model <> "Model Descriptor Not Found in EDID data") then
item = item & " " & vbcrlf
item = item & " " & escape_xml(manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(device_id) & "" & vbcrlf
item = item & " " & escape_xml(manufacture_date) & "" & vbcrlf
item = item & " " & escape_xml(model) & "" & vbcrlf
item = item & " " & escape_xml(serial) & "" & vbcrlf
item = item & " " & escape_xml(edid_version) & "" & vbcrlf
item = item & " " & escape_xml(ratio) & "" & vbcrlf
item = item & " " & escape_xml(screen_size) & "" & vbcrlf
item = item & " " & vbcrlf
end if
all_device_id = all_device_id & device_id & " "
end if
manufacturer = ""
device_id = ""
manufacture_date = ""
serial = ""
model = ""
edid_version = ""
end if
next
end if ' ending if we got anything from HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY\
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "sound info" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_SoundDevice",,48)
for each objItem in colItems
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(objItem.DeviceID) & "" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "disk info" end if
result_partition = ""
result_mount_point = ""
item = ""
set colDiskDrives = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
for each objItem In colDiskDrives
hard_drive_caption = objItem.Caption
hard_drive_index = objItem.Index
hard_drive_interface_type = objItem.InterfaceType
hard_drive_scsi_logical_unit = objItem.SCSITargetId
hard_drive_model = objItem.Model
hard_drive_serial = ""
hard_drive_pnp_id = lcase(objItem.PNPDeviceID & "_0")
on error resume next
hard_drive_serial = objItem.SerialNumber
On Error Goto 0
if ((len(hard_drive_serial) < 2) or (isnull(hard_drive_serial))) then
hard_drive_serial = ""
end if
hard_drive_size = int(objItem.size / 1024 / 1024)
hard_drive_device_id = objItem.deviceid
hard_drive_partitions = objItem.Partitions
hard_drive_manufacturer = objItem.manufacturer
if (hard_drive_manufacturer = "(Standard disk drives)") then
if left(hard_drive_model, 6) = "Maxtor" then hard_drive_manufacturer = "Maxtor" end if
if left(hard_drive_model, 2) = "ST" then hard_drive_manufacturer = "Seagate" end if
if left(hard_drive_model, 4) = "WDC " then hard_drive_manufacturer = "Western Digital" end if
end if
hard_drive_status = "Not available"
on error resume next
set DriveStatus = objWMIService2.ExecQuery("SELECT * FROM MSStorageDriver_FailurePredictStatus",,16)
if isnull(DriveStatus) then
' do nothing - no return value
else
for each objItem2 in DriveStatus
if (lcase(objItem2.InstanceName) = hard_drive_pnp_id) then
if (objItem2.PredictFailure <> "False" and objItem2.Active = "True") then
hard_drive_status = objItem2.PredictFailure & " because of " & objItem2.Reason
else
hard_drive_status = "OK"
end if
end if
next
end if
on error goto 0
item = item & " " & vbcrlf
item = item & " " & escape_xml(hard_drive_caption) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_index) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_interface_type) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_model) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_serial) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_size) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_device_id) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_partitions) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_status) & "" & vbcrlf
item = item & " " & escape_xml(hard_drive_scsi_logical_unit) & "" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "partition info" end if
set colPartitions = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk where DriveType = '2' or DriveType = '3'",,48)
for each objPartition In colPartitions
partition_index = ""
partition_mount_point = ""
partition_name = ""
partition_size = 0
partition_free_space = 0
partition_used_space = 0
partition_format = ""
partition_caption = ""
partition_type = ""
partition_quotas_supported = ""
partition_quotas_enabled = ""
partition_serial = ""
partition_bootable = ""
'partition_index = objPartition.Index '''''''''''''''''''''''''''''''''
partition_size = int(objPartition.Size /1024 /1024)
partition_device_id = ""
partition_disk_index = ""
set colLinks = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDiskToPartition",,48)
for each colLink in colLinks
if (inStr(colLink.Dependent, objPartition.DeviceID) > 0) then
partition_device_id_array = split(colLink.Antecedent, """")
partition_device_id = partition_device_id_array(1)
disk_index_array = split(partition_device_id, "#")
disk_index_new = disk_index_array(1)
partition_disk_index = mid(disk_index_new, 1, instr(disk_index_new, ",")-1)
disk_index_new = ""
end if
next
partition_mount_point = objPartition.Caption
partition_name = objPartition.VolumeName
partition_free_space = int(objPartition.FreeSpace /1024 /1024)
partition_used_space = int(partition_size - partition_free_space)
partition_format = objPartition.FileSystem
partition_caption = objPartition.Caption
partition_serial = objPartition.VolumeSerialNumber
partition_type = "local hard disk"
' below only checks when OS is XP or later (not 2000 or NT)
'if (windows_build_number > 2195) then
' if isnull(objLogicalDisk.SupportsDiskQuotas) then
' partition_quotas_supported = "false"
' else
' partition_quotas_supported = "true"
' end if
'else
' partition_quotas_supported = "false"
'end if
if (partition_size > "") then
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_disk_index) & "" & vbcrlf
result_partition = result_partition & " partition" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_mount_point) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_name) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_size) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_free_space) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_used_space) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_format) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_caption) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(partition_device_id) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf '''''
result_partition = result_partition & " " & vbcrlf '''''
result_partition = result_partition & " " & escape_xml(partition_type) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf '''''
result_partition = result_partition & " " & vbcrlf '''''
result_partition = result_partition & " " & escape_xml(partition_serial) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf
end if
next
if skip_mount_point = "n" then
if debugging > "0" then wscript.echo "mount point info" end if
on error resume next
set colMounts = objWMIService.ExecQuery("Select * from Win32_Volume WHERE DriveLetter = NULL",,48)
for each mount in colMounts
mount_caption = mount.Caption
mount_name = mount.Label
mount_size = int(mount.Capacity /1024 /1024)
mount_free_space = int(mount.FreeSpace /1024 /1024)
mount_used_space = int(mount_size - mount_free_space)
mount_format = mount.FileSystem
mount_serial = mount.SerialNumber
mount_type = "volume"
if (mount_size > "") then
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " mount point" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_caption) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_name) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_size) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_free_space) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_used_space) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_format) & "" & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_caption) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_type) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & vbcrlf
result_partition = result_partition & " " & escape_xml(mount_serial) & "" & vbcrlf
result_partition = result_partition & " " & vbcrlf
end if
next
On Error Goto 0
end if
if result_partition > "" then
result = result & " " & vbcrlf
result = result & result_partition
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "shares info" end if
' test to see if the share permissions .exe exists
file_exists = "false"
if strComputer = "." then
if objFSO.FileExists("C:\RMTSHARE.exe") then
file_exists = "true"
else
' copy the file to the machine being audited
end if
' TODO - get rmtshare.exe from OA server, if needed
end if
' NOTE - only selecting "Disk Drive" type shares.
' This does not include default shares.
set colItems = objWMIService.ExecQuery("Select * from Win32_Share where type='0'",,48)
for each objItem in colItems
result_users = ""
share_users = ""
folder_size = ""
if ((objItem.Path > "") AND _
not isnull(objItem.Path) AND _
objItem.Path <> "C:\WINNT" AND _
objItem.Path <> "C:\WINDOWS" AND _
objItem.Path <> "C:\" AND _
right(objItem.Path, 1) <> "\" AND _
len(objItem.Path) > 3 AND _
strComputer = "." ) then
on error resume next
Set objFolder = objFSO.GetFolder(objItem.Path)
folder_size = int(objFolder.size/1024/1024)
On Error Goto 0
' note - removed the below line from the conditions above
' right(objItem.Name, 1) <> "$" AND _
else
folder_size = ""
end if
if ((objItem.Path > "") AND _
not isnull(objItem.Path) AND _
objItem.Path <> "C:\WINNT" AND _
objItem.Path <> "C:\WINDOWS" AND _
objItem.Path <> "C:\" AND _
right(objItem.Path, 1) <> "\" AND _
len(objItem.Path) > 3 AND _
strComputer <> "." ) then
on error resume next
' disabled - causing timeout issues
remote_share = "\\" & system_hostname & "\" & objItem.Name
'Set objFolder = objFSO.GetFolder(remote_share)
'folder_size = int(objFolder.size/1024/1024)
folder_size = 0
On Error Goto 0
end if
result_share = result_share & " " & vbcrlf
result_share = result_share & " " & escape_xml(objItem.Name) & "" & vbcrlf
result_share = result_share & " " & escape_xml(objItem.Caption) & "" & vbcrlf
result_share = result_share & " " & escape_xml(objItem.Path) & "" & vbcrlf
result_share = result_share & " " & escape_xml(folder_size) & "" & vbcrlf
if file_exists = "true" then
strCommand = "c:\RMTSHARE.EXE \\" & system_hostname & "\""" & objItem.Name & """ "
set objExecObject = objShell.Exec(strCommand)
do While Not objExecObject.StdOut.AtEndOfStream
strResults = objExecObject.StdOut.ReadAll()
Loop
MyArray = Split(strResults, vbcrlf)
flag = false
for each line in MyArray
if line = "The command completed successfully." then
flag = false
end if
if flag = true then
newArray = split(line, ":")
if (left(ltrim(newArray(0)),1) = "\") then
newArray(0) = mid(trim(newArray(0)), 2)
end if
share_users = share_users & trim(newArray(0)) & "(" & trim(newArray(1)) & "), "
end if
if line = "Permissions:" then
flag = true
end if
next
if share_users > "" then
share_users = left(share_users, len(share_users)-2)
result_share = result_share & " " & escape_xml(share_users) & "" & vbcrlf
end if
end if
result_share = result_share & " " & vbcrlf
next
if result_share > "" then
result = result & " " & vbcrlf
result = result & result_share
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "network card info" end if
result = result & " " & vbcrlf
set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration " _
& "WHERE IPEnabled = 'True' or (ServiceName<>'' 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 Description<>'PPP Adapter.') " _
& "AND MACAddress is not NULL" ,,48)
on error resume next
for each objItem in colItems
net_dns_server = ""
net_index = objItem.Index
if (not isnull(objItem.MACAddress)) then
net_mac_address = objItem.MACAddress
else
net_mac_address = ""
end if
net_description = objItem.Description
net_dhcp_enabled = objItem.DHCPEnabled
net_dhcp_server = objItem.DHCPServer
if (not isnull(objItem.DHCPLeaseObtained)) then
net_dhcp_lease_obtained = WMIDateStringToDate(objItem.DHCPLeaseObtained)
else
net_dhcp_lease_obtained = ""
end if
if (not isnull(objItem.DHCPLeaseExpires)) then
net_dhcp_lease_expires = WMIDateStringToDate(objItem.DHCPLeaseExpires)
else
net_dhcp_lease_expires = ""
end if
if (not isnull(objItem.DNSServerSearchOrder)) then
net_dns_server = Join(objItem.DNSServerSearchOrder, ",")
else
net_dns_server = ""
end if
net_dns_host_name = objItem.DNSHostName
net_dns_domain = objItem.DNSDomain
net_ip_enabled = objItem.IPEnabled
net_dns_domain_reg_enabled = objItem.DomainDNSRegistrationEnabled
net_wins_primary = objItem.WINSPrimaryServer
net_wins_lmhosts_enabled = objItem.WINSEnableLMHostsLookup
net_wins_secondary = objItem.WINSSecondaryServer
set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter WHERE Index='" & net_index & "'",,48)
if (not isnull(colItems2)) then
for each objItem2 in colItems2
if (not isnull(objItem2)) then
net_adapter_type = objItem2.AdapterType
net_manufacturer = objItem2.Manufacturer
net_model = objItem2.ProductName
' below only checks when OS is XP or later (not 2000 or NT)
if (windows_build_number > 2195) then
net_connection_id = objItem2.NetConnectionID
net_connection_status = WMINetConnectorStatus(objItem2.NetConnectionStatus)
if (objItem2.NetConnectionStatus = "2" or objItem2.NetConnectionStatus = "9") then
' Found a connected NIC: detecting link speed
set colItems3 = objWMIService2.ExecQuery("Select * from MSNdis_LinkSpeed WHERE InstanceName = '" & net_description & "'",,48)
for each objItem3 in colItems3
net_speed = objItem3.NdisLinkSpeed
next
end if
else
net_connection_id = ""
net_connection_status = ""
net_speed = ""
end if
result = result & " " & vbcrlf
result = result & " " & escape_xml(net_mac_address) & "" & vbcrlf
result = result & " " & escape_xml(net_manufacturer) & "" & vbcrlf
result = result & " " & escape_xml(net_model) & "" & vbcrlf
result = result & " " & escape_xml(net_description) & "" & vbcrlf
result = result & " " & escape_xml(net_ip_enabled) & "" & vbcrlf
result = result & " " & escape_xml(net_index) & "" & vbcrlf
result = result & " " & escape_xml(net_connection_id) & "" & vbcrlf
result = result & " " & escape_xml(net_connection_status) & "" & vbcrlf
result = result & " " & escape_xml(net_speed) & "" & vbcrlf
result = result & " " & escape_xml(net_adapter_type) & "" & vbcrlf
result = result & " " & escape_xml(net_dhcp_enabled) & "" & vbcrlf
result = result & " " & escape_xml(net_dhcp_server) & "" & vbcrlf
result = result & " " & escape_xml(net_dhcp_lease_obtained) & "" & vbcrlf
result = result & " " & escape_xml(net_dhcp_lease_expires) & "" & vbcrlf
result = result & " " & escape_xml(net_dns_host_name) & "" & vbcrlf
result = result & " " & escape_xml(net_dns_domain) & "" & vbcrlf
result = result & " " & escape_xml(net_dns_domain_reg_enabled) & "" & vbcrlf
result = result & " " & escape_xml(net_dns_server) & "" & vbcrlf
result = result & " " & escape_xml(net_wins_primary) & "" & vbcrlf
result = result & " " & escape_xml(net_wins_secondary) & "" & vbcrlf
result = result & " " & escape_xml(net_wins_lmhosts_enabled) & "" & vbcrlf
result = result & " " & vbcrlf
end if
next
end if
next
result = result & " " & vbcrlf
On Error Goto 0
if debugging > "0" then wscript.echo "network address info" end if
item = ""
dim ip_address_array(20)
count = 0
set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True' ",,48)
for each objItem in colItems
net_mac_address = objItem.MACAddress
if net_mac_address > "" then
for i = LBound(objItem.IPAddress) to UBound(objItem.IPAddress)
ip_address = objItem.IPAddress(i)
ip_subnet = objItem.IPSubnet(i)
if len(ip_address) > 15 then
ip_address_version = "6"
ip_address_v6 = ip_address
ip_address_v4 = ""
else
ip_address_version = "4"
ip_address_v4 = ip_address
ip_address_v6 = ""
end if
if ip_address <> "0.0.0.0" then
count = count + 1
item = item & " " & vbcrlf
item = item & " " & escape_xml(net_mac_address) & "" & vbcrlf
item = item & " " & escape_xml(ip_address_v4) & "" & vbcrlf
item = item & " " & escape_xml(ip_address_v6) & "" & vbcrlf
item = item & " " & escape_xml(ip_subnet) & "" & vbcrlf
item = item & " " & escape_xml(ip_address_version) & "" & vbcrlf
item = item & " " & vbcrlf
if ip_address_version = "4" then
ip_address_array(count) = ip_address_v4
end if
end if
next
end if
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if (skip_printer = "n") then
if debugging > "0" then wscript.echo "printer info" end if
item = ""
colItems = Empty
on error resume next
Set objWMIService = GetObject("winmgmts:\\" & system_hostname & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
on error goto 0
if IsEmpty(colItems) then
' do nothing with printers - some error occured trying to query win32_printer
else
For Each objItem In colItems
printer_ip_address = ""
printer_hostname = ""
printer_system_key = ""
printer_manufacturer = ""
if ( (Instr(1, objItem.DriverName, "ActiveFax", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "AdobePS Acrobat Distiller", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Amyuni Document Converter", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Black Ice", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Canon DM Driver", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Canon iW Image Driver", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Citrix Universal Printer", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Document Publisher Plus Printer Driver", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "DocuWorks Printer Driver", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "MacromediaFlashPaper", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Fax", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "Microsoft", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "PaperPort", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "PDF", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "SnagIt", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "OneNote", vbTextCompare)) _
or (Instr(1, objItem.DriverName, "WebEx", vbTextCompare)) ) then
' software printer - do nothing for now
' todo - insert software printers into the software register (maybe)
else
if (InStr(objItem.PortName, "IP_") = 1) then
printer_ip_address = mid(objItem.PortName, 4)
Dim objExec
Set objExec = objShell.Exec( "nslookup " & printer_ip_address )
Dim objStream
k = ""
For Each objStream In Array( objExec.StdOut, objExec.StdErr )
Do Until objStream.AtEndOfStream
line = objStream.ReadLine()
if (InStr(line, "Name") = 1) then
i = split(line, ".")
k = mid(i(0), 6)
k = ltrim(k)
end if
Loop
Next
if (k <> "") then
printer_hostname = k
else
printer_hostname = printer_ip_address
end if
else
printer_ip_address = ""
end if
if (printer_ip_address > "") then
printer_system_key = printer_ip_address
else
printer_system_key = system_hostname & "_" & replace(objItem.DeviceID, " ", "_")
end if
printer_model = replace(objItem.DriverName, " PCL 5", "")
printer_model = replace(printer_model, " PCL 6", "")
printer_model = replace(printer_model, " PS", "")
if (instr(1, printer_model, "Aficio", vbTextCompare) = 1) then printer_manufacturer = "Ricoh" end if
if (instr(1, printer_model, "Brother", vbTextCompare) = 1) then printer_manufacturer = "Brother" end if
if (instr(1, printer_model, "Canon", vbTextCompare) = 1) then printer_manufacturer = "Canon" end if
if (instr(1, printer_model, "Color-MFPe", vbTextCompare) = 1) then printer_manufacturer = "Toshiba" end if
if (instr(1, printer_model, "DYMO", vbTextCompare) = 1) then printer_manufacturer = "Dymo" end if
if (instr(1, printer_model, "EasyCoder", vbTextCompare) = 1) then printer_manufacturer = "Intermec" end if
if (instr(1, printer_model, "Epson", vbTextCompare) = 1) then printer_manufacturer = "Epson" end if
if (instr(1, printer_model, "Fiery", vbTextCompare) = 1) then printer_manufacturer = "Konica Minolta" end if
if (instr(1, printer_model, "FX Document", vbTextCompare) = 1) then printer_manufacturer = "Xerox" end if
if (instr(1, printer_model, "HP ", vbTextCompare) = 1) then printer_manufacturer = "Hewlett Packard" end if
if (instr(1, printer_model, "Konica", vbTextCompare) = 1) then printer_manufacturer = "Konica Minolta" end if
if (instr(1, printer_model, "LAN-Fax", vbTextCompare) = 1) then printer_manufacturer = "Ricoh" end if
if (instr(1, printer_model, "Lexmark", vbTextCompare) = 1) then printer_manufacturer = "Lexmark" end if
if (instr(1, printer_model, "Mita", vbTextCompare) = 1) then printer_manufacturer = "Kyocera-Mita" end if
if (instr(1, printer_model, "Oce", vbTextCompare) = 1) then printer_manufacturer = "Oce" end if
if (instr(1, printer_model, "Ricoh", vbTextCompare) = 1) then printer_manufacturer = "Ricoh" end if
if (instr(1, printer_model, "Toshiba", vbTextCompare) = 1) then printer_manufacturer = "Toshiba" end if
if (instr(1, printer_model, "Xerox", vbTextCompare) = 1) then printer_manufacturer = "Xerox" end if
if (CInt(windows_build_number) > 2222 and not CInt(windows_build_number) = 3000) then
printer_comment = ""
if (objItem.ShareName > "") then
printer_shared = "true"
else
printer_shared = "false"
end if
else
printer_comment = objItem.Comment
printer_shared = objItem.Shared
end if
item = item & " " & vbcrlf
on error resume next
item = item & " " & escape_xml(printer_ip_address) & "" & vbcrlf
item = item & " " & escape_xml(printer_hostname) & "" & vbcrlf
item = item & " " & escape_xml(printer_system_key) & "" & vbcrlf
item = item & " " & escape_xml(replace(objItem.DeviceID, " ", "_")) & "" & vbcrlf
item = item & " " & escape_xml(printer_comment) & "" & vbcrlf
item = item & " printer" & vbcrlf
item = item & " " & escape_xml(printer_model) & "" & vbcrlf
item = item & " " & escape_xml(printer_manufacturer) & "" & vbcrlf
item = item & " " & escape_xml(objItem.PortName) & "" & vbcrlf
item = item & " " & escape_xml(printer_shared) & "" & vbcrlf
item = item & " " & escape_xml(objItem.ShareName) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Location) & "" & vbcrlf
On Error Goto 0
item = item & " " & vbcrlf
end if
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
end if
end if
if debugging > "0" then wscript.echo "scheduled tasks" end if
item = ""
' We rely on schtasks.exe so skipping if local system is older than WinXP
' Check Build Number: Win2k-->2195, Win98-->2222, WinME-->3000,
if ((CInt(windows_build_number) > 2222 and not CInt(windows_build_number) = 3000) and audit_location = "local" ) then
if windows_build_number = "2600" then
intOffset = 0
else
intOffset = 1
End if
strCommand = "%ComSpec% /c schtasks.exe /query /v /nh /fo csv"
strCommand = "schtasks.exe /query /v /nh /fo csv"
set objExecObject = objShell.Exec(strCommand)
do While Not objExecObject.StdOut.AtEndOfStream
strResults = objExecObject.StdOut.ReadAll()
Loop
MyArray = Split(strResults, vbcrlf)
for each line in MyArray
sTask = CSVParser(line)
if UCase(sTask(0)) = UCase(system_hostname) then
item = item & " " & vbcrlf
item = item & " " & sTask(1) & "" & vbcrlf
item = item & " " & sTask(2) & "" & vbcrlf
item = item & " " & sTask(3) & "" & vbcrlf
item = item & " " & sTask(4+intOffset) & "" & vbcrlf
item = item & " " & sTask(5+intOffset) & "" & vbcrlf
item = item & " " & sTask(6+intOffset) & "" & vbcrlf
item = item & " " & sTask(7+intOffset) & "" & vbcrlf
item = item & " " & sTask(8+intOffset) & "" & vbcrlf
item = item & " " & sTask(11+intOffset) & "" & vbcrlf
item = item & " " & sTask(18+intOffset) & "" & vbcrlf
item = item & " " & vbcrlf
end if
next
end if
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "environment variables" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_Environment where SystemVariable = 'True'",,48)
for each objItem in colItems
if (instr(lcase (escape_xml(objItem.VariableValue)), lcase (wshNetwork.userName)) or _
(instr(lcase (escape_xml(objItem.VariableValue)), lcase (strUser))) ) then
' do not record user specific variables
else
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.VariableValue) & "" & vbcrlf
item = item & " " & vbcrlf
end if
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "logs" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_NTEventLogFile",,48)
for each objItem in colItems
OverWritePolicy = objItem.OverWritePolicy
select case OverWritePolicy
case "OutDated" OverWritePolicy = "OutDated (after " & objItem.OverwriteOutDated & " days)"
case "WhenNeeded" OverWritePolicy = "As Needed"
end select
item = item & " " & vbcrlf
item = item & " " & escape_xml(objItem.LogFileName) & "" & vbcrlf
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.FileSize/1024) & "" & vbcrlf
item = item & " " & escape_xml(objItem.MaxFileSize/1024) & "" & vbcrlf
item = item & " " & escape_xml(OverWritePolicy) & "" & vbcrlf
item = item & " " & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "pagefile" end if
item = ""
set colItems = objWMIService.ExecQuery("Select * from Win32_PageFile",,48)
for each objItem in colItems
item = item & " " & escape_xml(objItem.Name) & "" & vbcrlf
item = item & " " & escape_xml(objItem.InitialSize) & "" & vbcrlf
item = item & " " & escape_xml(objItem.MaximumSize) & "" & vbcrlf
next
if item > "" then
result = result & " " & vbcrlf
result = result & item
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "local users info" end if
if ((windows_domain_role <> "Backup Domain Controller") and (windows_domain_role <> "Primary Domain Controller")) then
result = result & " " & vbcrlf
set colItems = objWMIService.ExecQuery ("Select * from Win32_UserAccount Where Domain = '" & system_hostname & "'")
if (not isnull(colItems)) then
for each objItem in colItems
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem.Name) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Caption) & "" & vbcrlf
result = result & " " & escape_xml(objItem.SID) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Domain) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Disabled) & "" & vbcrlf
result = result & " " & escape_xml(objItem.FullName) & "" & vbcrlf
result = result & " " & escape_xml(objItem.PasswordChangeable) & "" & vbcrlf
result = result & " " & escape_xml(objItem.PasswordExpires) & "" & vbcrlf
result = result & " " & escape_xml(objItem.PasswordRequired) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Status) & "" & vbcrlf
result = result & " local" & vbcrlf
result = result & " " & vbcrlf
next
end if
' The LocalSystem account
result = result & " " & vbcrlf
result = result & " LocalSystem" & vbcrlf
result = result & " " & escape_xml(system_hostname) & "\LocalSystem" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & ucase (escape_xml(system_hostname)) & "" & vbcrlf
result = result & " False" & vbcrlf
result = result & " LocalSystem" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " OK" & vbcrlf
result = result & " local" & vbcrlf
result = result & " " & vbcrlf
' The LocalService account
result = result & " " & vbcrlf
result = result & " NT AUTHORITY\LocalService" & vbcrlf
result = result & " NT AUTHORITY\LocalService" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & ucase (escape_xml(system_hostname)) & "" & vbcrlf
result = result & " False" & vbcrlf
result = result & " LocalSystem" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " OK" & vbcrlf
result = result & " local" & vbcrlf
result = result & " " & vbcrlf
' The NetworkService account
result = result & " " & vbcrlf
result = result & " NT AUTHORITY\NetworkService" & vbcrlf
result = result & " NT AUTHORITY\NetworkService" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & ucase (escape_xml(system_hostname)) & "" & vbcrlf
result = result & " False" & vbcrlf
result = result & " LocalSystem" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " False" & vbcrlf
result = result & " OK" & vbcrlf
result = result & " local" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
end if
if ((windows_domain_role <> "Backup Domain Controller") and (windows_domain_role <> "Primary Domain Controller")) then
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "local groups info" end if
if strUser = "" then
dim group_domain
dim member_domain
For Each group In GetObject("WinNT://" & system_hostname)
If group.Class = "Group" Then
group_members = ""
result = result & " " & vbcrlf
result = result & " " & escape_xml(group.Name) & "" & vbcrlf
result = result & " " & escape_xml(group.Description) & "" & vbcrlf
result = result & " " & escape_xml(group.GUID) & "" & vbcrlf
'result = result & " " & vbcrlf
For Each member In group.members
group_domain = split(member.ADSPath, "/")
member_domain = group_domain(ubound(group_domain)-1)
'result = result & " " & vbcrlf
'result = result & " " & escape_xml(member.name) & "" & vbcrlf
'result = result & " " & escape_xml(member.GUID) & "" & vbcrlf
'result = result & " " & escape_xml(member.class) & "" & vbcrlf
'result = result & " " & escape_xml(member_domain) & "" & vbcrlf
'result = result & " " & vbcrlf
group_members = group_members & member.name & "@" & member_domain & ", "
Next
'result = result & " " & vbcrlf
result = result & " " & escape_xml(group_members) & "" & vbcrlf
result = result & " " & vbcrlf
End If
Next
end if
if strUser > "" then
set colItems = objWMIService.ExecQuery("Select * from Win32_Group where Domain = '" & system_hostname & "'",,48)
for Each objItem in colItems
users = ""
set objDSO = GetObject("WinNT:")
set colGroups = objDSO.OpenDSObject("WinNT://" & system_hostname & "", strUser, strPass, ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION)
colGroups.Filter = Array("group")
group_members = ""
for Each objGroup In colGroups
if objGroup.Name = objItem.Name then
for each objUser in objGroup.Members
group_domain = split(objUser.ADSPath, "/")
member_domain = group_domain(ubound(group_domain)-1)
group_members = group_members & objUser.Name & "@" & member_domain & ", "
next
end if
next
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem.Name) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Description) & "" & vbcrlf
result = result & " " & escape_xml(objItem.SID) & "" & vbcrlf
result = result & " " & escape_xml(group_members) & "" & vbcrlf
result = result & " " & vbcrlf
group_members = ""
next
end if
result = result & " " & vbcrlf
end if
result = result & " " & vbcrlf
' commenting out the below routine for now
function disable()
if debugging > "0" then wscript.echo "BHO info" end if
if NOT InStr(system_os_full_name, "95") and NOT InStr(system_os_full_name, "98") and NOT InStr(system_os_full_name, "Vista") and NOT InStr(system_os_full_name, "Windows 7") and NOT InStr(system_os_full_name, "2008") then
set objWMIService_IE = GetObject("winmgmts:\\" & strComputer & "\root\cimv2\Applications\MicrosoftIE")
set colIESettings = objWMIService_IE.ExecQuery ("Select * from MicrosoftIE_Object")
for each strIESetting in colIESettings
result = result & " " & vbcrlf
result = result & " " & escape_xml(strIESetting.ProgramFile) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(strIESetting.CodeBase) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " browser addon" & vbcrlf
result = result & " " & escape_xml(strIESetting.CodeBase) & "" & vbcrlf
result = result & " " & escape_xml(strIESetting.Status) & "" & vbcrlf
result = result & " " & vbcrlf
next
end if
end function
if debugging > "0" then wscript.echo "Codec info" end if
set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CodecFile", , 48)
for each objItem In colItems
if objItem.Manufacturer <> "Microsoft Corporation" then
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem.Group) & " - " & objItem.Filename & "" & vbcrlf
result = result & " " & escape_xml(objItem.Version) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Caption) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem.InstallDate) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Manufacturer) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " codec" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
end if
next
if debugging > "0" then wscript.echo "ODBC Driver info" end if
strKeyPath = "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
for i = 0 to UBound(arrValueNames)
strValueName = arrValueNames(i)
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue1
if strValue1 = "Installed" then
oReg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\ODBC\ODBCINST.INI\" & strValueName,"DriverODBCVer",driver_version
oReg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\ODBC\ODBCINST.INI\" & strValueName,"Driver",file_name
result = result & " " & vbcrlf
result = result & " " & escape_xml(strValueName) & "" & vbcrlf
result = result & " " & escape_xml(driver_version) & "" & vbcrlf
result = result & " " & escape_xml(file_name) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " odbc driver" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
end if
next
if debugging > "0" then wscript.echo "MDAC info" end if
strKeyPath = "SOFTWARE\Microsoft\DataAccess"
strValueName = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dac_version
if SystemBuildNumber <> "6000" then
display_name = "MDAC"
else
display_name = "Windows DAC"
end if
result = result & " " & vbcrlf
result = result & " " & escape_xml(display_name) & "" & vbcrlf
result = result & " " & escape_xml(dac_version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://msdn2.microsoft.com/en-us/data/default.aspx" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "DirectX info" end if
strKeyPath = "SOFTWARE\Microsoft\DirectX"
strValueName = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dx_version
dx_name = ""
if dx_version = "4.07.00.0700" then dx_name = "DirectX 7" end if
if dx_version = "4.08.01.0810" then dx_name = "DirectX 8.1" end if
if dx_version = "4.08.01.0881" then dx_name = "DirectX 8.1" end if
if dx_version = "4.08.01.0901" then dx_name = "DirectX 8.1a" end if
if dx_version = "4.08.01.0901" then dx_name = "DirectX 8.1b" end if
if dx_version = "4.08.02.0134" then dx_name = "DirectX 8.2" end if
if dx_version = "4.09.00.0900" then dx_name = "DirectX 9" end if
if dx_version = "4.09.00.0901" then dx_name = "DirectX 9a" end if
if dx_version = "4.09.00.0902" then dx_name = "DirectX 9b" end if
if dx_version = "4.09.00.0903" then dx_name = "DirectX 9c" end if
if dx_version = "4.09.00.0904" then dx_name = "DirectX 9c" end if
if dx_name = "" then dx_name = "DirectX (unknown version)" end if
result = result & " " & vbcrlf
result = result & " " & escape_xml(dx_name) & "" & vbcrlf
result = result & " " & escape_xml(dx_version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://www.microsoft.com/windows/directx/" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "Windows Media Player info" end if
strKeyPath = "SOFTWARE\Microsoft\MediaPlayer\PlayerUpgrade"
strValueName = "PlayerVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,wmp_version
result = result & " " & vbcrlf
result = result & " Windows Media Player" & vbcrlf
result = result & " " & escape_xml(wmp_version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://www.microsoft.com/windows/windowsmedia/default.aspx" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "Internet Explorer info" end if
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer"
strValueName = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,ie_version
result = result & " " & vbcrlf
result = result & " Internet Explorer" & vbcrlf
result = result & " " & escape_xml(ie_version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://www.microsoft.com/windows/ie/community/default.mspx" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "Outlook Express info" end if
strKeyPath = "SOFTWARE\Microsoft\Outlook Express\Version info"
strValueName = "Current"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,oe_version
if (isnull(oe_version)) then
set colFiles = objWMIService.ExecQuery("Select * from CIM_Datafile Where Name = 'c:\\program files\\Outlook Express\\msimn.exe'",,48)
for each objFile in colFiles
result = result & " " & vbcrlf
result = result & " Outlook Express" & vbcrlf
result = result & " " & escape_xml(objFile.Version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://support.microsoft.com/default.aspx?xmlid=fh;en-us;oex" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
next
else
oe_version = replace(oe_version, ",", ".")
result = result & " " & vbcrlf
result = result & " Outlook Express" & vbcrlf
result = result & " " & escape_xml(oe_version) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_pc_date_os_installation) & "" & vbcrlf
result = result & " Microsoft Corporation" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " http://support.microsoft.com/default.aspx?xmlid=fh;en-us;oex" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
end if
if debugging > "0" then wscript.echo "Software info" end if
' note that I have a system that fails when the below is attempted.
on error resume next
Set colItems = objWMIService.ExecQuery("SELECT Message, User, TimeGenerated FROM Win32_NTLogEvent where logfile = 'Application' and eventcode = '11707'",,0)
On Error Goto 0
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE,strKeyPath,arrSubKeys
for each subkey In arrSubKeys
newpath = strKeyPath & "\" & subkey
newkey = "DisplayName"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
if strValue <> "" then
version = ""
uninstall_string = ""
install_date = ""
publisher = ""
install_source = ""
install_location = ""
system_component = ""
package_name = strValue
newkey = "DisplayVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_version = strValue
if (isnull(package_version)) then package_version = "" end if
newkey = "UninstallString"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_uninstall = strValue
if (isnull(package_uninstall)) then package_uninstall = "" end if
newkey = "InstallDate"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_install_date = strValue
if (isnull(package_install_date)) then package_install_date = "" end if
newkey = "Publisher"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_publisher = strValue
if (isnull(package_publisher)) then package_publisher = "" end if
newkey = "InstallSource"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_install_source = strValue
if (isnull(package_install_source)) then package_install_source = "" end if
newkey = "InstallLocation"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_location = strValue
if (isnull(package_location)) then package_location = "" end if
newkey = "SystemComponent"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_system_component = strValue
if (isnull(package_system_component)) then package_system_component = "" end if
newkey = "URLInfoAbout"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_url = strValue
if (isnull(package_url)) then package_url = "" end if
newkey = "Comments"
oReg.GetStringValue HKEY_LOCAL_MACHINE, newpath, newkey, strValue
package_comments = strValue
if (isnull(package_comments)) then package_comments = " " end if
package_installed_by = ""
package_installed_on = ""
on error resume next
for each objItem in colItems
if objItem.Message <> "" then
mess1 = split(objItem.Message, "--")
mess2 = split(mess1(0), " ", vbTextCompare)
mess3 = split(mess2(0), "Product:")
message_retrieved = trim(mess3(1))
if (not isNull(message_retrieved)) then
if (InStr(message_retrieved, package_name) = 1) then
package_installed_by = lcase(objItem.User)
package_installed_on = WMIDateStringToDate(objItem.TimeGenerated)
package_installed_on = datepart("yyyy", package_installed_on) & "-" & datepart("m", package_installed_on) & "-" & datepart("d", package_installed_on) & " " & datepart("h", package_installed_on) & ":" & datepart("n", package_installed_on) & ":" & datepart("s", package_installed_on)
exit for
else
package_installed_by = ""
package_installed_on = ""
end if
end if
end if
next
On Error Goto 0
result = result & " " & vbcrlf
result = result & " " & escape_xml(package_name) & "" & vbcrlf
result = result & " " & escape_xml(package_version) & "" & vbcrlf
result = result & " " & escape_xml(package_location) & "" & vbcrlf
result = result & " " & escape_xml(package_uninstall) & "" & vbcrlf
result = result & " " & escape_xml(package_install_date) & "" & vbcrlf
result = result & " " & escape_xml(package_publisher) & "" & vbcrlf
result = result & " " & escape_xml(package_install_source) & "" & vbcrlf
result = result & " " & escape_xml(package_system_component) & "" & vbcrlf
result = result & " " & escape_xml(package_url) & "" & vbcrlf
result = result & " " & vbcrlf
' result = result & " " & escape_xml(package_comments) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & lcase(escape_xml(package_installed_by)) & "" & vbcrlf
result = result & " " & escape_xml(package_installed_on) & "" & vbcrlf
result = result & " " & vbcrlf
end if
next
' need to test if this is a Win64 machine
strKeyPath = "SOFTWARE"
reg_node = "n"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if (not isnull(arrSubKeys)) then
For Each subkey In arrSubKeys
if subkey = "Wow6432Node" then
reg_node = "y"
end if
next
end if
if (address_width = "64" and reg_node = "y") then
if debugging > "0" then wscript.echo "Software for 64bit" end if
' we enumerate this WMI, that we would not otherwise
on error resume next
set colItems2 = objWMIService.ExecQuery("Select * from Win32_Product",,48)
error_returned = Err.Number
on error goto 0
if (error_returned <> 0) then
' we had an error - skip the next part
else
on error resume next
for each objItem2 in colItems2
error_returned = Err.Number
error_message = Err.Message
package_name = objItem2.name
package_installed_by = ""
package_installed_on = ""
if (system_os_family = "Windows 2008" or system_os_family = "Windows 7" or system_os_family = "Windows Vista") then
software_url = objItem2.URLUpdateInfo
software_install_source = objItem2.InstallSource
else
software_url = ""
software_install_source = ""
end if
for each objItem in colItems
if objItem.Message <> "" then
mess1 = split(objItem.Message, "--")
mess2 = split(mess1(0), " ", vbTextCompare)
mess3 = split(mess2(0), "Product:")
message_retrieved = trim(mess3(1))
if (not isNull(message_retrieved)) then
if (InStr(message_retrieved, package_name) = 1) then
package_installed_by = lcase(objItem.User)
package_installed_on = WMIDateStringToDate(objItem.TimeGenerated)
package_installed_on = datepart("yyyy", package_installed_on) & "-" & datepart("m", package_installed_on) & "-" & datepart("d", package_installed_on) & " " & datepart("h", package_installed_on) & ":" & datepart("n", package_installed_on) & ":" & datepart("s", package_installed_on)
exit for
else
package_installed_by = ""
package_installed_on = ""
end if
end if
end if
next
result = result & " " & vbcrlf
result = result & " " & escape_xml(package_name) & "" & vbcrlf
result = result & " " & escape_xml(objItem2.version) & "" & vbcrlf
result = result & " " & escape_xml(objItem2.InstallLocation) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem2.InstallDate) & "" & vbcrlf
result = result & " " & escape_xml(objItem2.Vendor) & "" & vbcrlf
result = result & " " & escape_xml(software_install_source) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(software_url) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & lcase(escape_xml(package_installed_by)) & "" & vbcrlf
result = result & " " & escape_xml(package_installed_on) & "" & vbcrlf
result = result & " " & vbcrlf
next
on error goto 0
end if
end if
' hotfixes
if (system_os_family = "Windows 2008" or system_os_family = "Windows 7" or system_os_family = "Windows Vista") then
if debugging > "0" then wscript.echo "Hotfix info" end if
set colItems2 = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering",,48)
for each objItem2 in colItems2
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem2.HotFixID) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem2.InstalledOn) & "" & vbcrlf
result = result & " Microsoft" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem2.Caption) & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " update" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
result = result & " " & lcase(escape_xml(objItem2.InstalledBy)) & "" & vbcrlf
result = result & " " & escape_xml(objItem2.InstalledOn) & "" & vbcrlf
result = result & " " & vbcrlf
next
end if
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "Services info" end if
en_sql_server = "n"
en_sql_express = "n"
result = result & " " & vbcrlf
set colItems = objWMIService.ExecQuery("Select * from Win32_Service",,48)
for each objItem in colItems
service_name = objItem.Name
result = result & " " & vbcrlf
result = result & " " & escape_xml(objItem.Description) & "" & vbcrlf
result = result & " " & escape_xml(objItem.DisplayName) & "" & vbcrlf
'result = result & " " & escape_xml(objItem.Name) & "" & vbcrlf
result = result & " " & objItem.Name & "" & vbcrlf
result = result & " " & escape_xml(objItem.PathName) & "" & vbcrlf
result = result & " " & escape_xml(objItem.Started) & "" & vbcrlf
result = result & " " & escape_xml(objItem.StartName) & "" & vbcrlf
result = result & " " & escape_xml(objItem.StartMode) & "" & vbcrlf
result = result & " " & escape_xml(objItem.State) & "" & vbcrlf
result = result & " " & vbcrlf
' Searching for server services
service_name = lcase(service_name)
select case service_name
case "iisadmin"
iis = "True"
case "w3svc"
iis_w3svc = "True"
case "msftpsvc"
iis_ftpsvc = "True"
case "smtpsvc"
iis_smtpsvc = "True"
case "nntpsvc"
iis_nntpsvc = "True"
case "mssqlserver"
en_sql_server = "y"
en_sql_server_state = objItem.State
case "sql server (mssqlserver)"
en_sql_server = "y"
en_sql_server_state = objItem.State
case "mssql$sqlexpress"
en_sql_express = "y"
en_sql_server = "y"
en_sql_server_state = objItem.State
case "sql server (sqlexpress)"
en_sql_express = "y"
en_sql_server = "y"
en_sql_server_state = objItem.State
end select
next
result = result & " " & vbcrlf
if en_sql_server = "y" then
if debugging > "0" then wscript.echo "SQL info" end if
oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion\","CSDVersion", db_version
If (IsNull(db_version)) Then
oReg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion\","CurrentVersion", db_version
End If
if debugging > "1" then wscript.echo "SQL Express: " & en_sql_express end if
if debugging > "1" then wscript.echo "SQL Server: " & en_sql_server end if
if debugging > "1" then wscript.echo "DB Version: " & db_version end if
i = ""
db_login_type = "Not in registry (possibly SQL Express)."
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\","LoginMode", i
if (IsNull(i) or i = "") then
oReg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL\","MSSQLSERVER", db_instance
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Microsoft SQL Server\" & db_instance & "\MSSQLServer\","LoginMode", i
end if
Select Case i
Case 0
db_login_type = "Allow SQL Server Authentication only."
' note - if we hit this, because we don't have SQL credentials, we don't enumerate databases
Case 1
db_login_type = "Allow Windows Authentication only."
Case 2
db_login_type = "Allow Windows Authentication or SQL Server Authentication."
Case 9
db_login_type = "Security type unknown."
' note - if we hit this, we don't enumerate databases
Case default
db_login_type = "Not in registry (possibly SQL Express)."
' note - if we hit this, we cannot log in to the DB Server, therefore, we don't enumerate databases
' TODO - not sure why this would occur.
End Select
if debugging > "1" then wscript.echo "DB Login Type: " & db_login_type end if
db_port = ""
oReg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib\Tcp\","TcpPort", db_port
if debugging > "1" then wscript.echo "DB Port: " & db_port end if
if en_sql_express = "y" then
db_type = "SQL Server Express"
else
db_type = "SQL Server"
end if
if debugging > "1" then wscript.echo "DB Type: " & db_type end if
if ( (en_sql_server_state = "Running") and ((i = 1) or (i = 2)) and (db_type = "SQL Server") ) then
'on error resume next
strBaseConnection ="Provider=SQLOLEDB; Integrated Security=SSPI;Persist Security Info=False; DATA SOURCE=" & strComputer & ";DATABASE=master"
Set objDBConnection = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.RecordSet")
on error resume next
objDBConnection.Open(strBaseConnection)
error_returned = Err.Number
on error goto 0
if (error_returned <> 0) then
if debugging > "1" then wscript.echo "Could not connect to SQL" end if
result = result & " " & vbcrlf
result = result & " " & db_type & " (possibly SSRS, SSIS or SSAS)" & vbcrlf
result = result & " " & escape_xml(db_version) & "" & vbcrlf
result = result & " " & db_port & "" & vbcrlf
result = result & " " & db_login_type & "" & vbcrlf
result = result & " " & en_sql_server_state & "" & vbcrlf
result = result & " " & vbcrlf
else
strQuery = "Select name, dbid, cmptlevel, filename, CONVERT(VARCHAR(19), crdate, 120) as crdate from sysdatabases order by name"
objRS.open strQuery, objDBConnection, 1
number_of_databases = cInt(objRS.RecordCount)
if debugging > "1" then wscript.echo "DB Count: " & number_of_databases end if
if (number_of_databases > 0) then
result = result & " " & vbcrlf
result = result & " " & db_type & "" & vbcrlf
result = result & " " & escape_xml(db_version) & "" & vbcrlf
result = result & " " & db_port & "" & vbcrlf
result = result & " " & db_login_type & "" & vbcrlf
result = result & " " & en_sql_server_state & "" & vbcrlf
result = result & " " & vbcrlf
result = result & " " & vbcrlf
Do Until objRS.Eof
' get the filesize
filename = replace(objRS.Fields("filename"), "\", "\\")
set colFiles = objWMIService.ExecQuery ("Select FileSize from CIM_Datafile Where name = '" & filename & "'")
for each objFile in colFiles
filesize = int(objFile.FileSize / 1024 / 1024)
next
database_name = CStr(objRS("Name"))
if debugging > "1" then wscript.echo "DB Name: " & database_name end if
result = result & " " & vbcrlf
result = result & " " & escape_xml(database_name) & "" & vbcrlf
result = result & " " & escape_xml(objRS("dbid")) & "" & vbcrlf
result = result & " " & CStr(objRS("CmptLevel")) & "" & vbcrlf
result = result & " " & escape_xml(objRS("FileName")) & "" & vbcrlf
result = result & " " & escape_xml(filesize) & "" & vbcrlf
result = result & " " & escape_xml(objRS("crdate")) & "" & vbcrlf
result = result & " " & vbcrlf
objRS.Movenext
Loop
result = result & " " & vbcrlf
else
result = result & " " & vbcrlf
result = result & " " & db_type & " (possibly SSRS, SSIS or SSAS)" & vbcrlf
result = result & " " & escape_xml(db_version) & "" & vbcrlf
result = result & " " & db_port & "" & vbcrlf
result = result & " " & db_login_type & "" & vbcrlf
result = result & " " & en_sql_server_state & "" & vbcrlf
result = result & " " & vbcrlf
end if
objRS.Close
objDBConnection.Close
end if
'On Error Goto 0
end if
end if
if ((iis_w3svc = "True") and (iis = "True")) then
iis_wmi = "False"
if debugging > "0" then wscript.echo "IIS info" end if
if CInt(windows_build_number) >= 3790 then
' Windows 2003 or newer
set objWMIService_Root = GetObject("winmgmts:\\" & strComputer & "\root")
set colItems = objWMIService_Root.InstancesOf("__NAMESPACE")
for each objItem in colItems
if objItem.Name = "MicrosoftIISv2" then
iis_wmi = "True"
end if
next
end if
if iis_wmi = "True" then
if strUser > "" then
set objWMIService_IIS = wmiLocator.ConnectServer(strComputer, "root/MicrosoftIISv2", strUser, strPass, "", "", wbemConnectFlagUseMaxWait)
objWMIService_IIS.Security_.authenticationLevel = 6
else
Set objWMIService_IIS = GetObject("winmgmts:{AuthenticationLevel=pktPrivacy}!\\" & strComputer & "\root\MicrosoftIISv2")
end if
Set colItems = objWMIService_IIS.ExecQuery("SELECT * FROM IIsWebInfo",,48)
For Each objItem in colItems
iis_version = objItem.MajorIIsVersionNumber & "." & objItem.MinorIIsVersionNumber
Next
result_webserver = result_webserver & " " & vbcrlf
result_webserver = result_webserver & " IIS" & vbcrlf
result_webserver = result_webserver & " " & escape_xml(iis_version) & "" & vbcrlf
result_webserver = result_webserver & " running" & vbcrlf
result_webserver = result_webserver & " " & vbcrlf
end if
if iis_wmi = "True" then
Set colItems = objWMIService_IIS.ExecQuery("SELECT * FROM IIsWebServiceSetting",,48)
For Each objItem in colItems
if (not isnull(objItem.WebSvcExtRestrictionList)) then
if (ubound(objItem.WebSvcExtRestrictionList) > 0) then
result_webserver = result_webserver & " " & vbcrlf
For i = 0 to Ubound(objItem.WebSvcExtRestrictionList)
If objItem.WebSvcExtRestrictionList(i).Access = 0 Then
iis_web_ext_access = "Not allowed"
Else
iis_web_ext_access = "Allowed"
End If
iis_web_ext_path = objItem.WebSvcExtRestrictionList(i).FilePath
iis_web_ext_desc = objItem.WebSvcExtRestrictionList(i).Description
Select Case iis_web_ext_path
Case "*.exe": iis_web_ext_desc = "All unknown CGI extensions"
Case "*.dll": iis_web_ext_desc = "All unknown ISAPI extensions"
Case Default:
End Select
result_webserver = result_webserver & " " & vbcrlf
result_webserver = result_webserver & " " & escape_xml(objItem.WebSvcExtRestrictionList(i).Description) & "" & vbcrlf
result_webserver = result_webserver & " " & escape_xml(objItem.WebSvcExtRestrictionList(i).FilePath) & "" & vbcrlf
result_webserver = result_webserver & " " & iis_web_ext_access & "" & vbcrlf
result_webserver = result_webserver & " " & vbcrlf
Next
result_webserver = result_webserver & " "
end if
end if
Next
end if
if iis_wmi = "True" then
result_site = " " & vbcrlf
Set colItems = objWMIService_IIS.ExecQuery("Select * from IIsWebServerSetting",,48)
For Each objItem in colItems
result_site = result_site & " " & vbcrlf
ArgSiteIndex = objItem.Name
' Stripping out "w3svc/"
site_id = Mid(ArgSiteIndex, 7)
result_site = result_site & " " & site_id & "" & vbcrlf
result_site = result_site & " " & escape_xml(objItem.ServerComment) & "" & vbcrlf
strQuery = "SELECT * FROM IIsWebServer WHERE Name = '" & ArgSiteIndex & "'"
Set colItems1 = objWMIService_IIS.ExecQuery(strQuery,,48)
For Each objItem1 in colItems1
Select Case objItem1.ServerState
Case 1: result_site = result_site & " Starting" & vbcrlf
Case 2: result_site = result_site & " Running" & vbcrlf
Case 3: result_site = result_site & " Stopping" & vbcrlf
Case 4: result_site = result_site & " Stopped" & vbcrlf
Case 5: result_site = result_site & " Pausing" & vbcrlf
Case 6: result_site = result_site & " Paused" & vbcrlf
Case 7: result_site = result_site & " Continuing" & vbcrlf
Case Default: result_site = result_site & " Unknown" & vbcrlf
End Select
Next
' Logging
strQuery = "SELECT * FROM IIsLogModuleSetting WHERE LogModuleId = '" & objItem.LogPluginClsid & "'"
Set colItems1 = objWMIService_IIS.ExecQuery(strQuery,,48)
Select Case objItem.LogType
Case 0: result_site = result_site & " disabled" & vbcrlf
Case 1: result_site = result_site & " enabled" & vbcrlf
Case Default: result_site = result_site & " undefined" & vbcrlf
End Select
For Each objItem1 in colItems1
LogFormat = Split(objItem1.Name, "/")
result_site = result_site & " " & escape_xml(LogFormat(1)) & "" & vbcrlf
result_site = result_site & " " & escape_xml(objItem.LogFileDirectory) & "" & vbcrlf
Next
Select Case objItem.LogFilePeriod
Case 0: If objItem.LogFileTruncateSize = -1 Then
result_site = result_site & " Unlimited file size" & vbcrlf
Else
result_site = result_site & " When file size reaches " & (objItem.LogFileTruncateSize/1048576) & " MB" & vbcrlf
End If
Case 1: result_site = result_site & " daily" & vbcrlf
Case 2: result_site = result_site & " weekly" & vbcrlf
Case 3: result_site = result_site & " monthly" & vbcrlf
Case 4: result_site = result_site & " hourly" & vbcrlf
Case Default: result_site = result_site & " undefined" & vbcrlf
End Select
' End of Logging
' Host Headers
result_host_headers = ""
For i = 0 to Ubound(objItem.ServerBindings)
result_host_headers = result_host_headers & " " & vbcrlf
If objItem.ServerBindings(i).IP = "" Then
result_host_headers = result_host_headers & " default" & vbcrlf
Else
result_host_headers = result_host_headers & " " & escape_xml(objItem.ServerBindings(i).IP) & "" & vbcrlf
End If
result_host_headers = result_host_headers & " " & escape_xml(objItem.ServerBindings(i).Port) & "" & vbcrlf
result_host_headers = result_host_headers & " " & escape_xml(objItem.ServerBindings(i).Hostname) & "" & vbcrlf
result_host_headers = result_host_headers & " " & vbcrlf
Next
' End of Host Headers
' Secure Bindings
For i = 0 to Ubound(objItem.SecureBindings)
If objItem.SecureBindings(i).IP = "" Then
iis_sec_ip = "No secure bindings"
Else
iis_sec_ip = objItem.SecureBindings(i).IP
End If
iis_sec_port = objItem.SecureBindings(i).Port
result_site = result_site & " " & escape_xml(iis_sec_ip) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_sec_port) & "" & vbcrlf
Next
' End of Secure Bindings
' Virtual Directories
result_iis_virt_dir = ""
Set colItems2 = objWMIService_IIS.ExecQuery("SELECT * FROM IIsWebVirtualDirSetting",,48)
For Each objItem2 in colItems2
If (UCase(objItem2.Name) = ArgSiteIndex & "/ROOT") Then
iis_path = objItem2.Path
iis_site_app_pool = objItem2.AppPoolId
iis_dir_browsing = objItem2.EnableDirBrowsing
iis_site_anonymous_user = objItem2.AnonymousUserName
iis_site_anonymous_auth = objItem2.AuthAnonymous
iis_site_basic_auth = objItem2.AuthBasic
iis_site_ntlm_auth = objItem2.AuthNTLM
iis_site_ssl_en = objItem2.AccessSSL
iis_site_ssl_128_en = objItem2.AccessSSL128
iis_def_doc = objItem2.DefaultDoc
End If
If (InStr(Ucase(objItem2.Name),ArgSiteIndex & "/ROOT/")) Then
temp = Split(objItem2.Name, "/")
result_iis_virt_dir = result_iis_virt_dir & " " & vbcrlf
result_iis_virt_dir = result_iis_virt_dir & " " & escape_xml(temp(3)) & "" & vbcrlf
result_iis_virt_dir = result_iis_virt_dir & " " & escape_xml(objItem2.Path) & "" & vbcrlf
result_iis_virt_dir = result_iis_virt_dir & " " & escape_xml(objItem2.AppPoolId) & "" & vbcrlf
result_iis_virt_dir = result_iis_virt_dir & " " & vbcrlf
End If
Next
' End of Virtual Directories
if strComputer = "." then
Set objFolder = objFSO.GetFolder(iis_path)
site_size = int(objFolder.size / 1024 / 1024) ' NOTE - only works when run locally. Returns in MB.
else
site_size = ""
end if
result_site = result_site & " " & escape_xml(iis_path) & "" & vbcrlf
result_site = result_site & " " & escape_xml(site_size) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_app_pool) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_dir_browsing) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_anonymous_user) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_anonymous_auth) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_basic_auth) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_ntlm_auth) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_ssl_en) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_site_ssl_128_en) & "" & vbcrlf
result_site = result_site & " " & escape_xml(iis_def_doc) & "" & vbcrlf
if (result_host_headers > "") then
result_site = result_site & " " & vbcrlf
result_site = result_site & result_host_headers
result_site = result_site & " " & vbcrlf
end if
if (result_iis_virt_dir > "") then
result_site = result_site & " " & vbcrlf
result_site = result_site & result_iis_virt_dir
result_site = result_site & " " & vbcrlf
end if
result_site = result_site & " " & vbcrlf
result_host_headers = ""
result_iis_virt_dir = ""
Next
result_site = result_site & " "
end if
if iis_wmi = "True" then
Set colItems = objWMIService_IIS.ExecQuery("SELECT * FROM IIsApplicationPoolSetting",,48)
if (isnull(colItems)) then
' do nothing
else
result_app_pool = result_app_pool & " " & vbcrlf
For Each objItem in colItems
result_app_pool = result_app_pool & " " & vbcrlf
temp = Split(objItem.Name, "/")
result_app_pool = result_app_pool & " " & escape_xml(temp(2)) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.PeriodicRestartTime) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.PeriodicRestartRequests) & "" & vbcrlf
for each rs in objItem.PeriodicRestartSchedule
result_app_pool = result_app_pool & " " & escape_xml(rs) & "" & vbcrlf
next
result_app_pool = result_app_pool & " " & escape_xml(objItem.PeriodicRestartPrivateMemory) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.PeriodicRestartMemory) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.IdleTimeout) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.MaxProcesses) & "" & vbcrlf
result_app_pool = result_app_pool & " " & escape_xml(objItem.WAMUserName) & "" & vbcrlf
result_app_pool = result_app_pool & " " & vbcrlf
Next
result_app_pool = result_app_pool & " "
end if
end if
if iis_wmi = "True" then
result = result & " " & vbcrlf
result = result & result_webserver & vbcrlf
result = result & result_site & vbcrlf
result = result & result_app_pool & vbcrlf
result = result & " " & vbcrlf
end if
end if
result = result & " " & vbcrlf
if debugging > "0" then wscript.echo "CD Keys" end if
'''''''''''''''''''''''''''''''''''''''''''''''''
' MS CD Keys for Windows 2000 onwards '
'''''''''''''''''''''''''''''''''''''''''''''''''
win_cd_key = "n"
IsOSXP = InStr(OSName, "Windows XP")
IsOS2K = InStr(OSName, "Windows 2000")
IsOS2K3 = InStr(OSName, "Server 2003")
IsOSVista = InStr(OSName, "Windows Vista")
IsOS2K8 = InStr(OSName, "2008")
IsOS7 = InStr(OSName, "Windows 7")
IsOSMicrosoft = CInt(IsOSXP + IsOS2K + IsOS2K3 + IsOSVista + IsOS2K8 + IsOS7)
if (IsOSMicrosoft > 0) then
path = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
subKey = "DigitalProductId"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key
key_text = getkey(key, 1)
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_os_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(windows_build_number) & "" & vbcrlf
result = result & " " & escape_xml(system_os_version) & "" & vbcrlf
result = result & " " & vbcrlf
strOffXPRUKey = ""
release_type = ""
edition_type = ""
win_cd_key = "y"
end if
end if
'''''''''''''''''''''''''''''''''''''''''''''''''
' MS CD Keys for Windows 64bit '
'''''''''''''''''''''''''''''''''''''''''''''''''
Subhive="SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
objCtx.Add "__RequiredArchitecture", TRUE
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
if strUser <> "" then
' Username & Password provided - assume not a domain local PC.
Set objServices = objLocator.ConnectServer(system_hostname, "root\default", strUser, strPass, "", "", wbemConnectFlagUseMaxWait, objCtx)
else
Set objServices = objLocator.ConnectServer(system_hostname, "root\default", "", "", "", "", wbemConnectFlagUseMaxWait, objCtx)
end if
Set o64reg = objServices.Get("StdRegProv")
key_text = null
Set Inparams = o64reg.Methods_("GetStringValue").Inparameters
Inparams.Hdefkey = HKEY_LOCAL_MACHINE
Inparams.Ssubkeyname = Subhive
Inparams.Svaluename = "DigitalProductID"
set Outparams = o64reg.ExecMethod_("GetBinaryValue", Inparams,,objCtx)
key_text = getkey(Outparams.uValue, 1)
if (IsNull(key_text) or (win_cd_key = "y")) then
' do nothing
else
win_cd_key = "y"
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_os_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(windows_build_number) & "" & vbcrlf
result = result & " " & escape_xml(system_os_version) & "" & vbcrlf
result = result & " " & vbcrlf
end if
Inparams.Svaluename = "DigitalProductID4"
set Outparams = o64reg.ExecMethod_("GetBinaryValue", Inparams,,objCtx)
if IsNull(Outparams.uValue) then
key_text = NULL
else
key_text = getkey(Outparams.uValue, 1)
end if
if (IsNull(key_text) or (win_cd_key = "y")) then
' do nothing
else
win_cd_key = "y"
result = result & " " & vbcrlf
result = result & " " & escape_xml(system_os_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(windows_build_number) & "" & vbcrlf
result = result & " " & escape_xml(system_os_version) & "" & vbcrlf
result = result & " " & vbcrlf
end if
''''''''''''''''''''''''''''''''
' MS CD Keys for Office XP '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Office\10.0\Registration"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if (not isnull(arrSubKeys)) then
For Each subkey In arrSubKeys
key_name = get_sku_xp(subkey)
key_release = get_release_type(subkey)
key_edition = get_edition_type(subkey)
path = strKeyPath & "\" & subkey
subKey = "DigitalProductId"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key
if IsNull(key) then
else
key_text = getkey(key, 1)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
next
end if
''''''''''''''''''''''''''''''''
' MS CD Keys for Office 2003 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Registration"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if (not isnull(arrSubKeys)) then
for each subkey In arrSubKeys
key_name = get_sku_2003(subkey)
key_release = get_release_type(subkey)
key_edition = get_edition_type(subkey)
path = strKeyPath & "\" & subkey
subKey = "DigitalProductId"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key
if IsNull(key) then
' do nothing
else
key_text = getkey(key, 1)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
next
end if
''''''''''''''''''''''''''''''''
' MS CD Keys for Office 2007 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Office\12.0\Registration"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if (not isnull(arrSubKeys)) then
For Each subkey In arrSubKeys
key_name = get_sku_2007(subkey)
key_release = get_release_type(subkey)
key_edition = get_edition_type(subkey)
path = strKeyPath & "\" & subkey
subKey = "DigitalProductId"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key
if IsNull(key) then
' do nothing
else
key_text = getkey(key, 1)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
Next
end if
''''''''''''''''''''''''''''''''
' MS CD Keys for Office 2010 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Office\14.0\Registration"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if (not isnull(arrSubKeys)) then
For Each subkey In arrSubKeys
key_name = get_sku_2010(subkey)
key_release = get_release_type(subkey)
key_edition = get_edition_type(subkey)
path = strKeyPath & "\" & subkey
subKey = "DigitalProductId"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key
if IsNull(key) then
' do nothing
else
key_text = getkey(key, 2)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
Next
end if
function busted()
'''''''''''''''''''''''''''''''''''''''''''
' MS CD Keys for Office 2010 from 64-bit'
'''''''''''''''''''''''''''''''''''''''''''
wscript.echo "office 2010 64bit"
Subhive="SOFTWARE\Microsoft\Office\14.0\Registration"
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
objCtx.Add "__RequiredArchitecture", TRUE
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer(system_hostname, "root\default", "", "", "", "", wbemConnectFlagUseMaxWait, objCtx)
Set o64reg = objServices.Get("StdRegProv")
Set Inparams = o64reg.Methods_("EnumKey").Inparameters
Inparams.Hdefkey = HKEY_LOCAL_MACHINE
Inparams.Ssubkeyname = subhive
set Outparams = o64reg.ExecMethod_("EnumKey", Inparams,,objCtx)
For Each strSubKey In Outparams.snames
key=null
Set Inparams = o64reg.Methods_("GetStringValue").Inparameters
Inparams.Hdefkey = HKEY_LOCAL_MACHINE
Inparams.Ssubkeyname = Subhive & "\" & strSubKey
Inparams.Svaluename = "DigitalProductID"
set Outparams = o64reg.ExecMethod_("GetBinaryValue", Inparams,,objCtx)
if IsNull(Outparams.uValue) then
key_text = NULL
else
key_text = getkey(Outparams.uValue, 2)
end if
if IsNull(key_text) then
' do nothing
else
key_name = get_sku_2010(strsubkey)
key_release = get_release_type(strsubkey)
key_edition = get_edition_type(strsubkey)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_name = ""
key_text = ""
key_release = ""
key_edition = ""
end if
Next
end function
''''''''''''''''''''''''''''''''
' SQL Svr 2000 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Microsoft SQL Server\80\Registration"
key_name = "SQL Server 2000"
key_release = ""
key_edition = ""
subKey = "CD_Key"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' SQL Svr 2005 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Microsoft SQL Server\90\ProductID\"
key_name = "Microsoft SQL Server 2005"
key_release = ""
key_edition = ""
subKey = "DigitalProductID77556"
key_text = GetSN(strComputer,HKEY_LOCAL_MACHINE,strKeyPath,subKey)
if IsNull(key_text) or key_text = "" then
strKeyPath = "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup\"
subKey = "DigitalProductID"
key_text = GetSN(strComputer,HKEY_LOCAL_MACHINE,strKeyPath,subKey)
if IsNull(key_text) or key_text = "" then
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' SQL Svr 2008 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Setup"
key_name = "SQL Server 2008"
key_release = ""
key_edition = ""
subKey = "DigitalProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
if IsNull(key) then
' do nothing
else
key_text = getkey(key, 1)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Visual Studio 2010 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Registration"
key_name = "Microsoft Visual Studio 2010"
key_release = ""
key_edition = ""
subKey = "ProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
If IsNull(key) OR key = "" then
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Registration\01018"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
if IsNull(key) OR key = "" then
else
key_text = key
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
else
key_text = key
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Visual Studio 2008 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Registration"
key_name = "Microsoft Visual Studio 2008"
key_edition = ""
key_release = ""
subKey = "ProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) or key_text = "" then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Visual Studio 2005 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Registration"
key_name = "Microsoft Visual Studio 2005"
key_edition = ""
key_release = ""
subKey = "ProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) or key_text = "" then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Illustrator 10.0 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Illustrator\10\Registration"
key_name = "Adobe Illustrator 10.0"
key_edition = "10.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Photoshop 7.0 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Photoshop\7.0\Registration"
key_name = "Adobe Photoshop 7"
key_edition = "7.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Photoshop 5.0 LE '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Photoshop 5.0 Limited Edition"
key_name = "Adobe Photoshop 5.0 LE"
key_edition = "5.0 LE"
key_release = ""
subKey = "ProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Acrobat 5 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 5.0"
key_name = "Adobe Acrobat 5"
key_edition = "5.0"
key_release = ""
subKey = "ProductID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
'Adobe Acrobat 6
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Adobe Acrobat\6.0\Registration"
key_name = "Adobe Acrobat 6"
key_edition = "6.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Acrobat 7 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Adobe Acrobat\7.0\Registration"
key_name = "Adobe Acrobat 7"
key_edition = "7.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
if IsNull(key) then
' do nothing
else
key_text = get_adobe(key)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Acrobat 8 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Adobe Acrobat\8.0\Registration"
key_name = "Adobe Acrobat 8"
key_edition = "8.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
if IsNull(key) then
' do nothing
else
key_text = get_adobe(key)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Adobe Acrobat 9 '
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Adobe\Adobe Acrobat\9.0\Registration"
key_name = "Adobe Acrobat 9"
key_edition = "9.0"
key_release = ""
subKey = "SERIAL"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key
if IsNull(key) then
' do nothing
else
key_text = get_adobe(key)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2004 LT
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD LT\R9\ACLT-201:40A"
key_name = "Autocad 2004 LT"
key_edition = "2004 LT"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2005 LT
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD LT\R10\ACLT-301:409"
key_name = "Autocad 2005 LT"
key_edition = "2005 LT"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2006 LT
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD LT\R11\ACLT-4001:409"
key_name = "Autocad 2006 LT"
key_edition = "2006 LT"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2007
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-5001:409"
key_name = "AutoCAD 2007"
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2008 (1)
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R17.1\ACAD-6001:409"
key_name = "AutoCAD 2008"
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2008 (2)
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R17.1\ACAD-6014:409"
key_name = "AutoCAD 2008 "
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2008 LT
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD LT\R13\ACLT-6001:409"
key_name = "AutoCAD 2008 LT"
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2009
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7001:409"
key_name = "AutoCAD 2009"
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''
' Autocad 2009 LT
''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD LT\R14\ACADLT-7001:409"
key_name = "AutoCAD 2009 LT"
key_edition = ""
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
subKey = "ProductId"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2010 (1)
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8005:40C"
key_name = "AutoCAD 2010"
key_edition = "2010"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2010 (2)
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409"
key_name = "AutoCAD 2010 "
key_edition = "2010"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Autocad 2011
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\AutoCAD\R18.1\ACAD-9001:409"
key_name = "AutoCAD 2011"
key_edition = "2011"
key_release = ""
subKey = "SerialNumber"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Release"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Inventor 2008
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Autodesk\Inventor\RegistryVersion10.0"
key_name = "Inventor 2008"
key_edition = "2008"
key_release = ""
subKey = "SerialNumberPrefix"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, subKey, key1
subKey = "SerialNumberSuffix"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, subKey, key2
key_text = key1 & "-" & key2
if IsNull(key_text) or key_text = "-" then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' SolidWorks 2008
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\SolidWorks\Security"
key_name = "SolidWorks 2008"
key_edition = "2008"
key_release = ""
subKey = "Serial Number"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' MathCAD 2008
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Mathsoft\Mathcad 14\Install"
key_name = "MathCAD 2008"
key_edition = "2008"
key_release = ""
on error resume next
subKey = "SERIALNUMBER1"
oReg.GetStringValue HKEY_LOCAL_MACHINE, Path, subKey, key1
subKey = "SERIALNUMBER2"
oReg.GetStringValue HKEY_LOCAL_MACHINE, Path, subKey, key2
subKey = "SERIALNUMBER3"
oReg.GetStringValue HKEY_LOCAL_MACHINE, Path, subKey, key3
key_text = key1 & "-" & key2 & "-" & key3
On Error goto 0
if IsNull(key_text) or key_text = "--" then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Crystal Reports 9
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Crystal Decisions\9.0\Crystal Reports\Keycodes"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
if IsNull(arrSubKeys) then
' do nothing
else
For Each subkey In arrSubKeys
key_name = "Crystal Reports 9.0 " & subkey
key_release = ""
key_edition = subkey
path = strKeyPath & "\" & subkey
subKey = ""
oReg.GetStringValue HKEY_LOCAL_MACHINE,Path,subKey,key_text
if IsNull(key_text) then
' do nothing
else
key_text = Mid(key_text,3,21)
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
Next
end if
''''''''''''''''''''''''''''''''
' Crystal Reports 11
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Business Objects\Suite 11.0\Crystal Reports"
key_name = "Crystal Reports 11"
key_edition = "11"
key_release = ""
subKey = "PIDKEY"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' PowerDVD
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\CyberLink\PowerDVD"
key_name = "PowerDVD "
key_edition = ""
key_release = ""
subKey = "CDKey"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
key_name = key_name & key_release
subKey = "VType"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_edition
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' Nero 6
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\Ahead\Nero - Burning Rom\Info"
key_name = "Nero Burning Rom 6.0"
key_edition = ""
key_release = "6.0"
subKey = "Serial6"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' VMWare Workstation 4
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\VMware, Inc.\VMware Workstation\License.ws.4.0"
key_name = "VMWare Workstation 4"
key_edition = ""
key_release = "4.0"
subKey = "Serial"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' VMWare Workstation 5
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\VMware, Inc.\VMware Workstation\License.ws.5.0"
key_name = "VMWare Workstation 5"
key_edition = ""
key_release = "5.0"
subKey = "Serial"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' VMWare Workstation 7
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\VMware, Inc.\VMware Workstation\License.ws.7.0.e1.200904"
key_name = "VMWare Workstation 7"
key_edition = ""
key_release = "7.0"
subKey = "Serial"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "LicenseVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
''''''''''''''''''''''''''''''''
' VMWare Workstation 7
''''''''''''''''''''''''''''''''
strKeyPath = "SOFTWARE\VMware, Inc.\VMware Workstation\License.ws.7.0.e1.200904"
key_name = "VMWare Workstation 7"
key_edition = ""
key_release = "7.0"
subKey = "Serial"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_text
if IsNull(key_text) then
' do nothing
else
subKey = "LicenseVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,subKey,key_release
result = result & " " & vbcrlf
result = result & " " & escape_xml(key_name) & "" & vbcrlf
result = result & " " & escape_xml(key_text) & "" & vbcrlf
result = result & " " & escape_xml(key_release) & "" & vbcrlf
result = result & " " & escape_xml(key_edition) & "" & vbcrlf
result = result & " " & vbcrlf
key_text = ""
key_release = ""
key_edition = ""
end if
result = result & " " & vbcrlf
' NOTE - Have moved to end of audit incase processing fails.
' The rest of the audit data should be processed fine.
'function route()
' below only checks when OS is XP or later (not 2000 or NT)
if (windows_build_number > 2195) then
if debugging > "0" then wscript.echo "network routing info" end if
result = result & " " & vbcrlf
set colItems = objWMIService.ExecQuery("Select * from Win32_IP4RouteTable",,48)
for each objItem in colItems
Protocol = objItem.Protocol
select case Protocol
case "1" Protocol = "Other"
case "2" Protocol = "Local"
case "3" Protocol = "Netmgmt"
case "4" Protocol = "icmp"
case "5" Protocol = "egp"
case "6" Protocol = "ggp"
case "7" Protocol = "hello"
case "8" Protocol = "rip"
case "9" Protocol = "is-is"
case "10" Protocol = "es-is"
case "11" Protocol = "CiscoIgrp"
case "12" Protocol = "bbnSpfIgp"
case "13" Protocol = "ospf"
case "14" Protocol = "bgp"
case else Protocol = "unknown"
end select
RouteType = objItem.Type
select case RouteType
case "1" RouteType = "Other"
case "2" RouteType = "Invalid"
case "3" RouteType = "Direct"
case "4" RouteType = "Indirect"
case else RouteType = "unknown"
end select
ip_hit = "0"
for i = 1 to ubound(ip_address_array)
if (objItem.NextHop = ip_address_array(i)) then
ip_hit = "1"
end if
next
if ( (ip_hit = "1") or (objItem.NextHop = "127.0.0.1") ) then
' do nothing
else
result = result & " " & vbcrlf
result = result & " " & objItem.Destination & "" & vbcrlf
result = result & " " & objItem.Mask & "" & vbcrlf
result = result & " " & objItem.Metric1 & "" & vbcrlf
result = result & " " & objItem.NextHop & "" & vbcrlf
result = result & " " & Protocol & "" & vbcrlf
result = result & " " & RouteType & "" & vbcrlf
result = result & " " & vbcrlf
end if
ip_hit = "0"
next
result = result & " " & vbcrlf
end if
'end function
'end of the audit
result = result & ""
audit_time = Timer
elapsed_time = audit_time - start_time
if debugging > "0" then wscript.echo "Audit Generated in " & int(elapsed_time) & " seconds." end if
if create_file = "y" then
if debugging > "0" then wscript.echo "Creating output File" end if
' Write the results to a file
dim dt : dt = Now()
file_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)
OutputFile = system_hostname & "-" & file_timestamp & ".txt"
if debugging > "0" then wscript.echo "Output file: " & OutputFile end if
Err.clear
on error resume next
set objTS = objFSO.OpenTextFile(OutputFile, FOR_APPENDING, True)
error_returned = Err.Number
error_description = Err.Description
on error goto 0
if (error_returned <> 0) then
if debugging > "0" then wscript.echo "Problem Creating File to open." end if
if debugging > "0" then wscript.echo "Error Number:" & error_returned end if
if debugging > "0" then wscript.echo "Error Description:" & error_description end if
else
Err.Clear
on error resume next
objTS.Write cStr(result)
error_returned = Err.Number
error_description = Err.Description
on error goto 0
if (error_returned <> 0) then
if debugging > "0" then wscript.echo "Problem writing to file." end if
if debugging > "0" then wscript.echo "Error Number:" & error_returned end if
if debugging > "0" then wscript.echo "Error Description:" & error_description end if
else
if debugging > "0" then wscript.echo "Output file created." end if
end if
end if
end if
if submit_online = "y" then
if debugging > "0" then wscript.echo "Submitting audit online" end if
url = url & "/add_system"
Err.clear
XmlObj = "ServerXMLHTTP"
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.setTimeouts 5000, 5000, 5000, 0
objHTTP.SetOption 2, 13056 ' Ignore all SSL errors
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
objHTTP.Send "form_systemXML=" + urlEncode(result + vbcrlf)
if (Err.Number <> 0 or objHTTP.status <> 200) then
if debugging > "0" then wscript.echo "inside the second http request" end if
XmlObj = "XMLHTTP"
Set objHTTP = WScript.CreateObject("MSXML2.XMLHTTP")
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
objHTTP.Send "form_systemXML=" + result
end if
Err.clear
if debugging > "0" then wscript.echo "Audit Submitted" end if
if (objHTTP.ResponseText > "" and debugging > "1") then
wscript.echo
wscript.echo
wscript.echo "Response"
wscript.echo "--------"
wscript.echo objHTTP.ResponseText
if (inStr(objHTTP.ResponseText, "error")) then
wscript.sleep 50000
end if
end if
end if
end_time = Timer
elapsed_time = end_time - start_time
if debugging > "0" then wscript.echo "Total Execution Time: " & int(elapsed_time) & " seconds." end if
if self_delete = "y" then
objFSO.DeleteFile WScript.ScriptFullName
end if
wscript.quit
function windows_user_get_attribute1 (attribute, sam_account_name)
SET objRootDSE = GetObject("LDAP://RootDSE")
strRoot = objRootDSE.GET("DefaultNamingContext")
strfilter = "(&(objectCategory=person)(sAMAccountName=" & sam_account_name & "))"
' "(&(objectCategory=Person)(objectClass=User))"
strAttributes = attribute
strScope = "subtree"
SET cn = CREATEOBJECT("ADODB.Connection")
SET cmd = CREATEOBJECT("ADODB.Command")
cn.Provider = "ADsDSOObject"
cn.Open "Active Directory Provider"
cmd.ActiveConnection = cn
cmd.Properties("Page Size") = 1000
cmd.commandtext = ";" & strFilter & ";" & strAttributes & ";" & strScope
SET rs = cmd.EXECUTE
wscript.echo cmd.commandtext
wscript.echo Err.Number
windows_user_get_attribute = rs.Fields(0).Value
if rs.Fields.Count > 0 then
for i = 0 To rs.Fields.Count - 1
windows_user_get_attribute = rs.Fields(i).Value
next
else
windows_user_get_attribute = "unable"
end if
end function
Function Deconstruct(strIn)
strOut = ""
For x = 1 to Len(strIn)
If Asc(Mid(strIn,x,1)) > 128 Then
strOut = strOut & "" & Asc(Mid(strIn,x,1))
Else
strOut = strOut & Mid(strIn,x,1)
End If
Next
Deconstruct = strOut
End Function
Function ConvertComputerName2ADSPath(ByVal sCName)
Const ADS_SCOPE_ONELEVEL = 1
Const ADS_SCOPE_SUBTREE = 2
Dim CnSubAD,CmSubAD,RsSubRec,oSubUsr,oSubRootDSE,oSubDom
set oSubRootDSE = GetObject("LDAP://RootDSE")
set oSubDom = GetObject ("LDAP://" & oSubRootDSE.Get("defaultNamingContext"))
Set CnSubAD = CreateObject("ADODB.Connection")
CnSubAD.Provider = "ADsDSOObject"
CnSubAD.Open
Set CmSubAD = CreateObject("ADODB.Command")
Set CmSubAD.ActiveConnection = CnSubAD
CmSubAD.CommandText = "Select ADsPath FROM 'LDAP://" & oSubDom.distinguishedname & "' WHERE objectClass = 'computer' and Name = '" & sCName & "'"
'wscript.echo CmSubAD.CommandText
CmSubAD.Properties("searchscope") = ADS_SCOPE_SUBTREE
On Error Resume Next
Set RsSubRec = CmSubAD.Execute
If Err.Number <> 0 Then
WScript.Echo Err.Number & " - " & Err.Description
End If
On Error goto 0
Do While Not RsSubRec.EOF
ConvertComputerName2ADSPath = RsSubRec.Fields("ADsPath").Value
RsSubRec.MoveNext
Loop
Set oSubUsr = nothing
End Function
Function urlEncode(sString)
Dim nIndex, aCode, theString
Set theString = CreateObject("ADODB.Stream")
theString.Type = 2
theString.Open
theString.Position = 0
For nIndex = 1 to Len(sString)
aCode = AscW(Mid(sString,nIndex,1))
'convert from twos complement
If aCode < 0 Then
aCode = 65536 + aCode
End If
If ((aCode >= 48 and aCode <= 57) or (aCode >= 65 and aCode <=90) or (aCode >= 97 and aCode <= 122)) then
' Alphanumerics
theString.WriteText Chr(aCode)
elseif (aCode = 45 or aCode = 46 or aCode = 95 or aCode = 126) then
' Following characters: - / . / _ / ~
theString.WriteText Chr(aCode)
elseif (aCode < 16) then
theString.WriteText "%0" & Hex(aCode)
elseif (aCode < 128) then
theString.WriteText "%" & Hex(aCode)
elseif (aCode < 2048) then
theString.WriteText "%" & hex(((aCode) \ 2^6) or 192)
theString.WriteText "%" & hex(((aCode and 63)) or 128)
elseif (aCode < 65536) then
theString.WriteText "%" & hex(((aCode) \ 2^12) or 224)
theString.WriteText "%" & hex(((aCode and 4032) \ 2^6) or 128)
theString.WriteText "%" & hex(((aCode and 63)) or 128)
end if
Next
theString.position = 0
urlEncode = theString.ReadText()
End Function
function escape_xml(data)
if IsNull(data) then
escape_xml = ""
else
data = replace(data, "®", "")
data = replace(data,"&","&")
data = replace(data,"<","<")
data = replace(data,">",">")
data = replace(data,"""",""")
data = replace(data,"'","'")
escape_xml = trim(data)
end if
end function
function escape_xml_software(data)
if IsNull(data) then
escape_xml_software = ""
else
data = replace(data, "®", "")
data = replace(data,"&","&")
data = replace(data,"<","<")
data = replace(data,">",">")
data = replace(data,"""",""")
data = replace(data,"'","'")
data = trim(data)
dim encoded_string
for i = 1 to len(data)
character = utf8(ascw(Mid(data,i,1)))
encoded_string = encoded_string & character
next
escape_xml_software = encoded_string
end if
end function
function utf8(ByVal c)
Dim b1, b2, b3
if c < 128 then
Utf8 = chr(c)
elseif c < 2048 then
b1 = c Mod 64
b2 = (c - b1) / 64
Utf8 = chr(&hc0 + b2) & chr(&h80 + b1)
elseif c < 65536 then
b1 = c Mod 64
b2 = ((c - b1) / 64) Mod 64
b3 = (c - b1 - (64 * b2)) / 4096
Utf8 = chr(&he0 + b3) & chr(&h80 + b2) & chr(&h80 + b1)
end if
end function
function form_factor(system_form_factor)
if system_form_factor = "1" then system_form_factor = "Other" end if
if system_form_factor = "2" then system_form_factor = "Unknown" end if
if system_form_factor = "3" then system_form_factor = "Desktop" end if
if system_form_factor = "4" then system_form_factor = "Low Profile Desktop" end if
if system_form_factor = "5" then system_form_factor = "Pizza Box" end if
if system_form_factor = "6" then system_form_factor = "Mini Tower" end if
if system_form_factor = "7" then system_form_factor = "Tower" end if
if system_form_factor = "8" then system_form_factor = "Portable" end if
if system_form_factor = "9" then system_form_factor = "Laptop" end if
if system_form_factor = "10" then system_form_factor = "Notebook" end if
if system_form_factor = "11" then system_form_factor = "Hand Held" end if
if system_form_factor = "12" then system_form_factor = "Docking Station" end if
if system_form_factor = "13" then system_form_factor = "All in One" end if
if system_form_factor = "14" then system_form_factor = "sub Notebook" end if
if system_form_factor = "15" then system_form_factor = "Space-Saving" end if
if system_form_factor = "16" then system_form_factor = "Lunch Box" end if
if system_form_factor = "17" then system_form_factor = "Main System Chassis" end if
if system_form_factor = "18" then system_form_factor = "Expansion Chassis" end if
if system_form_factor = "19" then system_form_factor = "SubChassis" end if
if system_form_factor = "20" then system_form_factor = "Bus Expansion Chassis" end if
if system_form_factor = "21" then system_form_factor = "Peripheral Chassis" end if
if system_form_factor = "22" then system_form_factor = "Storage Chassis" end if
if system_form_factor = "23" then system_form_factor = "Rack Mount Chassis" end if
if system_form_factor = "24" then system_form_factor = "Sealed-case PC" end if
form_factor = system_form_factor
end function
function os_family(os)
if InStr(os, " 95") then os_family="Windows 95"
if InStr(os, " 98") then os_family="Windows 98"
if InStr(os, " NT") then os_family="Windows NT"
if InStr(os, "2000") then os_family="Windows 2000"
if InStr(os, " XP") then os_family="Windows XP"
if InStr(os, "2003") then os_family="Windows 2003"
if InStr(os, "Vista") then os_family="Windows Vista"
if InStr(os, "2008") then os_family="Windows 2008"
if InStr(os, "Windows 7") then os_family="Windows 7"
end function
function FixPath(ByRef sPathDisk, ByRef sPathPart)
Fixpath = "Win32_LogicalDiskToPartition.Antecedent=" & chr(34) & _
Replace(sPathPart,chr(34), "\" & chr(34)) & chr(34) & "," & _
"Dependent=" & chr(34) & Replace(sPathDisk,chr(34), "\" & _
chr(34)) & chr(34)
end function
function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
end function
function WMINetConnectorStatus(status)
if status = 0 then WMINetConnectorStatus = "Disconnected" end if
if status = 1 then WMINetConnectorStatus = "Connecting" end if
if status = 2 then WMINetConnectorStatus = "Connected" end if
if status = 3 then WMINetConnectorStatus = "Disconnecting" end if
if status = 4 then WMINetConnectorStatus = "Hardware not present" end if
if status = 5 then WMINetConnectorStatus = "Hardware disabled" end if
if status = 6 then WMINetConnectorStatus = "Hardware malfunction" end if
if status = 7 then WMINetConnectorStatus = "Media disconnected" end if
if status = 8 then WMINetConnectorStatus = "Authenticating" end if
if status = 9 then WMINetConnectorStatus = "Authentication succeeded" end if
if status = 10 then WMINetConnectorStatus = "Authentication failed" end if
if status = 11 then WMINetConnectorStatus = "Invalid address" end if
if status = 12 then WMINetConnectorStatus = "Credentials required" end if
end function
function WMIOSLanguage(lang)
if lang = "1" then WMIOSLanguage = "Arabic" end if
if lang = "4" then WMIOSLanguage = "Chinese (Simplified)– China" end if
if lang = "9" then WMIOSLanguage = "English" end if
if lang = "1025" then WMIOSLanguage = "Arabic - Saudi Arabia" end if
if lang = "1026" then WMIOSLanguage = "Bulgarian" end if
if lang = "1027" then WMIOSLanguage = "Catalan" end if
if lang = "1028" then WMIOSLanguage = "Chinese (Traditional) - Taiwan" end if
if lang = "1029" then WMIOSLanguage = "Czech" end if
if lang = "1030" then WMIOSLanguage = "Danish" end if
if lang = "1031" then WMIOSLanguage = "German – Germany" end if
if lang = "1032" then WMIOSLanguage = "Greek" end if
if lang = "1033" then WMIOSLanguage = "English - United States" end if
if lang = "1034" then WMIOSLanguage = "Spanish - Traditional Sort" end if
if lang = "1035" then WMIOSLanguage = "Finnish" end if
if lang = "1036" then WMIOSLanguage = "French - France" end if
if lang = "1037" then WMIOSLanguage = "Hebrew" end if
if lang = "1038" then WMIOSLanguage = "Hungarian" end if
if lang = "1039" then WMIOSLanguage = "Icelandic" end if
if lang = "1040" then WMIOSLanguage = "Italian - Italy" end if
if lang = "1041" then WMIOSLanguage = "Japanese" end if
if lang = "1042" then WMIOSLanguage = "Korean" end if
if lang = "1043" then WMIOSLanguage = "Dutch - Netherlands" end if
if lang = "1044" then WMIOSLanguage = "Norwegian - Bokmal" end if
if lang = "1045" then WMIOSLanguage = "Polish" end if
if lang = "1046" then WMIOSLanguage = "Portuguese - Brazil" end if
if lang = "1047" then WMIOSLanguage = "Rhaeto-Romanic" end if
if lang = "1048" then WMIOSLanguage = "Romanian" end if
if lang = "1049" then WMIOSLanguage = "Russian" end if
if lang = "1050" then WMIOSLanguage = "Croatian" end if
if lang = "1051" then WMIOSLanguage = "Slovak" end if
if lang = "1052" then WMIOSLanguage = "Albanian" end if
if lang = "1053" then WMIOSLanguage = "Swedish" end if
if lang = "1054" then WMIOSLanguage = "Thai" end if
if lang = "1055" then WMIOSLanguage = "Turkish" end if
if lang = "1056" then WMIOSLanguage = "Urdu" end if
if lang = "1057" then WMIOSLanguage = "Indonesian" end if
if lang = "1058" then WMIOSLanguage = "Ukrainian" end if
if lang = "1059" then WMIOSLanguage = "Belarusian" end if
if lang = "1060" then WMIOSLanguage = "Slovenian" end if
if lang = "1061" then WMIOSLanguage = "Estonian" end if
if lang = "1062" then WMIOSLanguage = "Latvian" end if
if lang = "1063" then WMIOSLanguage = "Lithuanian" end if
if lang = "1065" then WMIOSLanguage = "Persian" end if
if lang = "1066" then WMIOSLanguage = "Vietnamese" end if
if lang = "1069" then WMIOSLanguage = "Basque" end if
if lang = "1070" then WMIOSLanguage = "Serbian" end if
if lang = "1071" then WMIOSLanguage = "Macedonian (FYROM)" end if
if lang = "1072" then WMIOSLanguage = "Sutu" end if
if lang = "1073" then WMIOSLanguage = "Tsonga" end if
if lang = "1074" then WMIOSLanguage = "Tswana" end if
if lang = "1076" then WMIOSLanguage = "Xhosa" end if
if lang = "1077" then WMIOSLanguage = "Zulu" end if
if lang = "1078" then WMIOSLanguage = "Afrikaans" end if
if lang = "1080" then WMIOSLanguage = "Faeroese" end if
if lang = "1081" then WMIOSLanguage = "Hindi" end if
if lang = "1082" then WMIOSLanguage = "Maltese" end if
if lang = "1084" then WMIOSLanguage = "Gaelic" end if
if lang = "1085" then WMIOSLanguage = "Yiddish" end if
if lang = "1086" then WMIOSLanguage = "Malay - Malaysia" end if
if lang = "2049" then WMIOSLanguage = "Arabic - Iraq" end if
if lang = "2052" then WMIOSLanguage = "Chinese (Simplified) – PRC" end if
if lang = "2055" then WMIOSLanguage = "German - Switzerland" end if
if lang = "2057" then WMIOSLanguage = "English - United Kingdom" end if
if lang = "2058" then WMIOSLanguage = "Spanish - Mexico" end if
if lang = "2060" then WMIOSLanguage = "French - Belgium" end if
if lang = "2064" then WMIOSLanguage = "Italian - Switzerland" end if
if lang = "2067" then WMIOSLanguage = "Dutch - Belgium" end if
if lang = "2068" then WMIOSLanguage = "Norwegian - Nynorsk" end if
if lang = "2070" then WMIOSLanguage = "Portuguese - Portugal" end if
if lang = "2072" then WMIOSLanguage = "Romanian - Moldova" end if
if lang = "2073" then WMIOSLanguage = "Russian - Moldova" end if
if lang = "2074" then WMIOSLanguage = "Serbian - Latin" end if
if lang = "2077" then WMIOSLanguage = "Swedish - Finland" end if
if lang = "3073" then WMIOSLanguage = "Arabic - Egypt" end if
if lang = "3076" then WMIOSLanguage = "Chinese (Traditional) Hong Kong SAR" end if
if lang = "3079" then WMIOSLanguage = "German - Austria" end if
if lang = "3081" then WMIOSLanguage = "English - Australia" end if
if lang = "3082" then WMIOSLanguage = "Spanish - International Sort" end if
if lang = "3084" then WMIOSLanguage = "French - Canada" end if
if lang = "3098" then WMIOSLanguage = "Serbian - Cyrillic" end if
if lang = "4097" then WMIOSLanguage = "Arabic - Libya" end if
if lang = "4100" then WMIOSLanguage = "Chinese (Simplified) Singapore" end if
if lang = "4103" then WMIOSLanguage = "German - Luxembourg" end if
if lang = "4105" then WMIOSLanguage = "English - Canada" end if
if lang = "4106" then WMIOSLanguage = "Spanish - Guatemala" end if
if lang = "4108" then WMIOSLanguage = "French - Switzerland" end if
if lang = "5121" then WMIOSLanguage = "Arabic - Algeria" end if
if lang = "5127" then WMIOSLanguage = "German - Liechtenstein" end if
if lang = "5129" then WMIOSLanguage = "English - New Zealand" end if
if lang = "5130" then WMIOSLanguage = "Spanish - Costa Rica" end if
if lang = "5132" then WMIOSLanguage = "French - Luxembourg" end if
if lang = "6145" then WMIOSLanguage = "Arabic - Morocco" end if
if lang = "6153" then WMIOSLanguage = "English - Ireland" end if
if lang = "6154" then WMIOSLanguage = "Spanish - Panama" end if
if lang = "7169" then WMIOSLanguage = "Arabic - Tunisia" end if
if lang = "7177" then WMIOSLanguage = "English - South Africa" end if
if lang = "7178" then WMIOSLanguage = "Spanish - Dominican Republic" end if
if lang = "8193" then WMIOSLanguage = "Arabic - Oman" end if
if lang = "8201" then WMIOSLanguage = "English - Jamaica" end if
if lang = "8202" then WMIOSLanguage = "Spanish - Venezuela" end if
if lang = "9217" then WMIOSLanguage = "Arabic - Yemen" end if
if lang = "9226" then WMIOSLanguage = "Spanish - Colombia" end if
if lang = "10241" then WMIOSLanguage = "Arabic - Syria" end if
if lang = "10249" then WMIOSLanguage = "English - Belize" end if
if lang = "10250" then WMIOSLanguage = "Spanish - Peru" end if
if lang = "11265" then WMIOSLanguage = "Arabic - Jordan" end if
if lang = "11273" then WMIOSLanguage = "English - Trinidad" end if
if lang = "11274" then WMIOSLanguage = "Spanish - Argentina" end if
if lang = "12289" then WMIOSLanguage = "Arabic - Lebanon" end if
if lang = "12298" then WMIOSLanguage = "Spanish - Ecuador" end if
if lang = "13313" then WMIOSLanguage = "Arabic - Kuwait" end if
if lang = "13322" then WMIOSLanguage = "Spanish - Chile" end if
if lang = "14337" then WMIOSLanguage = "Arabic - U.A.E." end if
if lang = "14346" then WMIOSLanguage = "Spanish - Uruguay" end if
if lang = "15361" then WMIOSLanguage = "Arabic - Bahrain" end if
if lang = "15370" then WMIOSLanguage = "Spanish - Paraguay" end if
if lang = "16385" then WMIOSLanguage = "Arabic - Qatar" end if
if lang = "16394" then WMIOSLanguage = "Spanish - Bolivia" end if
if lang = "17418" then WMIOSLanguage = "Spanish - El Salvador" end if
if lang = "18442" then WMIOSLanguage = "Spanish - Honduras" end if
if lang = "19466" then WMIOSLanguage = "Spanish - Nicaragua" end if
if lang = "20490" then WMIOSLanguage = "Spanish - Puerto Rico" end if
end function
function WMIOSCountry(country)
if country = "1" then WMIOSCountry = "UNITED STATES" end if
if country = "2" then WMIOSCountry = "CANADA" end if
if country = "7" then WMIOSCountry = "RUSSIAN FEDERATION" end if
if country = "20" then WMIOSCountry = "EGYPT" end if
if country = "27" then WMIOSCountry = "SOUTH AFRICA" end if
if country = "30" then WMIOSCountry = "GREECE" end if
if country = "31" then WMIOSCountry = "NETHERLANDS" end if
if country = "32" then WMIOSCountry = "BELGIUM" end if
if country = "33" then WMIOSCountry = "FRANCE" end if
if country = "34" then WMIOSCountry = "SPAIN" end if
if country = "36" then WMIOSCountry = "HUNGARY" end if
if country = "39" then WMIOSCountry = "ITALY" end if
if country = "40" then WMIOSCountry = "ROMANIA" end if
if country = "41" then WMIOSCountry = "SWITZERLAND" end if
if country = "43" then WMIOSCountry = "AUSTRIA" end if
if country = "44" then WMIOSCountry = "UNITED KINGDOM" end if
if country = "45" then WMIOSCountry = "DENMARK" end if
if country = "46" then WMIOSCountry = "SWEDEN" end if
if country = "47" then WMIOSCountry = "NORWAY" end if
if country = "48" then WMIOSCountry = "POLAND" end if
if country = "49" then WMIOSCountry = "GERMANY" end if
if country = "51" then WMIOSCountry = "PERU" end if
if country = "52" then WMIOSCountry = "MEXICO" end if
if country = "54" then WMIOSCountry = "ARGENTINA" end if
if country = "55" then WMIOSCountry = "BRAZIL" end if
if country = "56" then WMIOSCountry = "CHILE" end if
if country = "57" then WMIOSCountry = "COLOMBIA" end if
if country = "58" then WMIOSCountry = "VENEZUELA" end if
if country = "60" then WMIOSCountry = "MALAYSIA" end if
if country = "61" then WMIOSCountry = "AUSTRALIA" end if
if country = "62" then WMIOSCountry = "INDONESIA" end if
if country = "63" then WMIOSCountry = "PHILIPPINES" end if
if country = "64" then WMIOSCountry = "NEW ZEALAND" end if
if country = "65" then WMIOSCountry = "SINGAPORE" end if
if country = "81" then WMIOSCountry = "JAPAN" end if
if country = "82" then WMIOSCountry = "KOREA, REPUBLIC OF" end if
if country = "84" then WMIOSCountry = "VIET NAM" end if
if country = "86" then WMIOSCountry = "CHINA" end if
if country = "90" then WMIOSCountry = "TURKEY" end if
if country = "91" then WMIOSCountry = "INDIA" end if
if country = "92" then WMIOSCountry = "PAKISTAN" end if
if country = "212" then WMIOSCountry = "MOROCCO" end if
if country = "213" then WMIOSCountry = "ALGERIA" end if
if country = "216" then WMIOSCountry = "TUNISIA" end if
if country = "218" then WMIOSCountry = "LIBYAN ARAB JAMAHIRIYA" end if
if country = "254" then WMIOSCountry = "KENYA" end if
if country = "263" then WMIOSCountry = "ZIMBABWE" end if
if country = "298" then WMIOSCountry = "FAROE ISLANDS" end if
if country = "351" then WMIOSCountry = "PORTUGAL" end if
if country = "352" then WMIOSCountry = "LUXEMBOURG" end if
if country = "353" then WMIOSCountry = "IRELAND" end if
if country = "354" then WMIOSCountry = "ICELAND" end if
if country = "355" then WMIOSCountry = "ALBANIA" end if
if country = "358" then WMIOSCountry = "FINLAND" end if
if country = "359" then WMIOSCountry = "BULGARIA" end if
if country = "370" then WMIOSCountry = "LITHUANIA" end if
if country = "371" then WMIOSCountry = "LATVIA" end if
if country = "372" then WMIOSCountry = "ESTONIA" end if
if country = "374" then WMIOSCountry = "ARMENIA" end if
if country = "375" then WMIOSCountry = "BELARUS" end if
if country = "380" then WMIOSCountry = "UKRAINE" end if
if country = "381" then WMIOSCountry = "SERBIA" end if
if country = "385" then WMIOSCountry = "CROATIA" end if
if country = "386" then WMIOSCountry = "SLOVENIA" end if
if country = "389" then WMIOSCountry = "MACEDONIA" end if
if country = "420" then WMIOSCountry = "CZECH REPUBLIC" end if
if country = "421" then WMIOSCountry = "SLOVAKIA (Slovak Republic)" end if
if country = "501" then WMIOSCountry = "BELIZE" end if
if country = "502" then WMIOSCountry = "GUATEMALA" end if
if country = "503" then WMIOSCountry = "EL SALVADOR" end if
if country = "504" then WMIOSCountry = "HONDURAS" end if
if country = "505" then WMIOSCountry = "NICARAGUA" end if
if country = "506" then WMIOSCountry = "COSTA RICA" end if
if country = "507" then WMIOSCountry = "PANAMA" end if
if country = "591" then WMIOSCountry = "BOLIVIA" end if
if country = "593" then WMIOSCountry = "ECUADOR" end if
if country = "595" then WMIOSCountry = "PARAGUAY" end if
if country = "598" then WMIOSCountry = "URUGUAY" end if
if country = "673" then WMIOSCountry = "BRUNEI DARUSSALAM" end if
if country = "852" then WMIOSCountry = "HONG KONG" end if
if country = "853" then WMIOSCountry = "MACAU" end if
if country = "874" then WMIOSCountry = "THAILAND" end if
if country = "886" then WMIOSCountry = "TAIWAN" end if
if country = "960" then WMIOSCountry = "MALDIVES" end if
if country = "961" then WMIOSCountry = "LEBANON" end if
if country = "962" then WMIOSCountry = "JORDAN" end if
if country = "963" then WMIOSCountry = "SYRIAN ARAB REPUBLIC" end if
if country = "964" then WMIOSCountry = "IRAQ" end if
if country = "965" then WMIOSCountry = "KUWAIT" end if
if country = "966" then WMIOSCountry = "SAUDI ARABIA" end if
if country = "967" then WMIOSCountry = "YEMEN" end if
if country = "968" then WMIOSCountry = "OMAN" end if
if country = "971" then WMIOSCountry = "UNITED ARAB EMIRATES" end if
if country = "972" then WMIOSCountry = "ISRAEL" end if
if country = "973" then WMIOSCountry = "BAHRAIN" end if
if country = "974" then WMIOSCountry = "QATAR" end if
if country = "976" then WMIOSCountry = "MONGOLIA" end if
if country = "981" then WMIOSCountry = "IRAN" end if
if country = "994" then WMIOSCountry = "AZERBAIJAN" end if
if country = "995" then WMIOSCountry = "GEORGIA" end if
if country = "996" then WMIOSCountry = "KYRGYZSTAN" end if
end function
function get_sku_xp(value)
vers = mid(value,4,2)
if vers = "11" then vers_name = "Microsoft Office XP Professional" end if
if vers = "12" then vers_name = "Microsoft Office XP Standard" end if
if vers = "13" then vers_name = "Microsoft Office XP Small Business" end if
if vers = "14" then vers_name = "Microsoft Office XP Web Server" end if
if vers = "15" then vers_name = "Microsoft Access 2002" end if
if vers = "16" then vers_name = "Microsoft Excel 2002" end if
if vers = "17" then vers_name = "Microsoft FrontPage 2002" end if
if vers = "18" then vers_name = "Microsoft PowerPoint 2002" end if
if vers = "19" then vers_name = "Microsoft Publisher 2002" end if
if vers = "1A" then vers_name = "Microsoft Outlook 2002" end if
if vers = "1B" then vers_name = "Microsoft Word 2002" end if
if vers = "1C" then vers_name = "Microsoft Access 2002 Runtime" end if
if vers = "1D" then vers_name = "Microsoft FrontPage Server Extensions 2002" end if
if vers = "1E" then vers_name = "Microsoft Office Multilingual User Interface Pack" end if
if vers = "1F" then vers_name = "Microsoft Office Proofing Tools Kit" end if
if vers = "20" then vers_name = "System Files Update" end if
if vers = "22" then vers_name = "unused" end if
if vers = "23" then vers_name = "Microsoft Office Multilingual User Interface Pack Wizard" end if
if vers = "24" then vers_name = "Microsoft Office XP Resource Kit" end if
if vers = "25" then vers_name = "Microsoft Office XP Resource Kit Tools (download from Web)" end if
if vers = "26" then vers_name = "Microsoft Office Web Components" end if
if vers = "27" then vers_name = "Microsoft Project 2002" end if
if vers = "28" then vers_name = "Microsoft Office XP Professional with FrontPage" end if
if vers = "29" then vers_name = "Microsoft Office XP Professional Subscription" end if
if vers = "2A" then vers_name = "Microsoft Office XP Small Business Edition Subscription" end if
if vers = "2B" then vers_name = "Microsoft Publisher 2002 Deluxe Edition" end if
if vers = "2F" then vers_name = "Standalone IME (JPN Only)" end if
if vers = "30" then vers_name = "Microsoft Office XP Media Content" end if
if vers = "31" then vers_name = "Microsoft Project 2002 Web Client" end if
if vers = "32" then vers_name = "Microsoft Project 2002 Web Server" end if
if vers = "33" then vers_name = "Microsoft Office XP PIPC1 (Pre Installed PC) (JPN Only)" end if
if vers = "34" then vers_name = "Microsoft Office XP PIPC2 (Pre Installed PC) (JPN Only)" end if
if vers = "35" then vers_name = "Microsoft Office XP Media Content Deluxe" end if
if vers = "3A" then vers_name = "Project 2002 Standard" end if
if vers = "3B" then vers_name = "Project 2002 Professional" end if
if vers = "51" then vers_name = "Microsoft Visio Professional 2002" end if
if vers = "54" then vers_name = "Microsoft Visio Standard 2002" end if
if vers = "5F" then vers_name = "Microsoft Visual Studio .NET Enterprise Architect 2003" end if
if vers = "60" then vers_name = "Microsoft Visual Studio .NET Enterprise Developer 2003" end if
if vers = "61" then vers_name = "Microsoft Visual Studio .NET Professional 2003" end if
if vers = "62" then vers_name = "Microsoft Visual Basic .NET Standard 2003" end if
if vers = "63" then vers_name = "Microsoft Visual C# .NET Standard 2003" end if
if vers = "64" then vers_name = "Microsoft Visual C++ .NET Standard 2003" end if
if vers = "65" then vers_name = "Microsoft Visual J# .NET Standard 2003" end if
get_sku_xp = vers_name
end function
function get_sku_2003(subkey)
vers = mid(subkey,4,2)
if vers = "11" then vers_name = "Microsoft Office Professional Enterprise Edition 2003" end if
if vers = "12" then vers_name = "Microsoft Office Standard Edition 2003" end if
if vers = "13" then vers_name = "Microsoft Office Basic Edition 2003" end if
if vers = "14" then vers_name = "Microsoft Windows SharePoint Services 2.0" end if
if vers = "15" then vers_name = "Microsoft Office Access 2003" end if
if vers = "16" then vers_name = "Microsoft Office Excel 2003" end if
if vers = "17" then vers_name = "Microsoft Office FrontPage 2003" end if
if vers = "18" then vers_name = "Microsoft Office PowerPoint 2003" end if
if vers = "19" then vers_name = "Microsoft Office Publisher 2003" end if
if vers = "1A" then vers_name = "Microsoft Office Outlook Professional 2003" end if
if vers = "1B" then vers_name = "Microsoft Office Word 2003" end if
if vers = "1C" then vers_name = "Microsoft Office Access 2003 Runtime" end if
if vers = "1E" then vers_name = "Microsoft Office 2003 User Interface Pack" end if
if vers = "1F" then vers_name = "Microsoft Office 2003 Proofing Tools" end if
if vers = "23" then vers_name = "Microsoft Office 2003 Multilingual User Interface Pack" end if
if vers = "24" then vers_name = "Microsoft Office 2003 Resource Kit" end if
if vers = "26" then vers_name = "Microsoft Office XP Web Components" end if
if vers = "2E" then vers_name = "Microsoft Office 2003 Research Service SDK" end if
if vers = "3A" then vers_name = "Microsoft Office Project Standard 2003" end if
if vers = "3B" then vers_name = "Microsoft Office Project Professional 2003" end if
if vers = "32" then vers_name = "Microsoft Office Project Server 2003" end if
if vers = "44" then vers_name = "Microsoft Office InfoPath 2003" end if
if vers = "49" then vers_name = "Microsoft Office 2003 Primary Interop Assemblies" end if
if vers = "51" then vers_name = "Microsoft Office Visio Professional 2003" end if
if vers = "52" then vers_name = "Microsoft Office Visio Viewer 2003" end if
if vers = "53" then vers_name = "Microsoft Office Visio Standard 2003" end if
if vers = "55" then vers_name = "Microsoft Office Visio for Enterprise Architects" end if
if vers = "5E" then vers_name = "Microsoft Office Visio 2003 Multilingual User Interface Pack" end if
if vers = "5F" then vers_name = "Microsoft Visual Studio .NET Enterprise Architect 2003" end if
if vers = "60" then vers_name = "Microsoft Visual Studio .NET Enterprise Developer 2003" end if
if vers = "61" then vers_name = "Microsoft Visual Studio .NET Professional 2003" end if
if vers = "62" then vers_name = "Microsoft Visual Basic .NET Standard 2003" end if
if vers = "63" then vers_name = "Microsoft Visual C# .NET Standard 2003" end if
if vers = "64" then vers_name = "Microsoft Visual C++ .NET Standard 2003" end if
if vers = "65" then vers_name = "Microsoft Visual J# .NET Standard 2003" end if
if vers = "83" then vers_name = "Microsoft Office 2003 HTML Viewer" end if
if vers = "92" then vers_name = "Windows SharePoint Services 2.0 English Template Pack" end if
if vers = "93" then vers_name = "Microsoft Office 2003 English Web Parts and Components" end if
if vers = "A1" then vers_name = "Microsoft Office OneNote 2003" end if
if vers = "A4" then vers_name = "Microsoft Office 2003 Web Components" end if
if vers = "A5" then vers_name = "Microsoft SharePoint Migration Tool 2003" end if
if vers = "AA" then vers_name = "Microsoft Office PowerPoint 2003 Presentation Broadcast" end if
if vers = "AB" then vers_name = "Microsoft Office PowerPoint 2003 Template Pack 1" end if
if vers = "AC" then vers_name = "Microsoft Office PowerPoint 2003 Template Pack 2" end if
if vers = "AD" then vers_name = "Microsoft Office PowerPoint 2003 Template Pack 3" end if
if vers = "AE" then vers_name = "Microsoft Organization Chart 2.0" end if
if vers = "CA" then vers_name = "Microsoft Office Small Business Edition 2003" end if
if vers = "D0" then vers_name = "Microsoft Office Access 2003 Developer Extensions" end if
if vers = "DC" then vers_name = "Microsoft Office 2003 Smart Document SDK" end if
if vers = "E0" then vers_name = "Microsoft Office Outlook Standard 2003" end if
if vers = "E3" then vers_name = "Microsoft Office Professional Edition 2003 (with InfoPath 2003)" end if
if vers = "FF" then vers_name = "Microsoft Office 2003 Edition Language Interface Pack" end if
if vers = "F8" then vers_name = "Remove Hidden Data Tool" end if
get_sku_2003 = vers_name
end function
function get_sku_2007(subkey)
vers = mid(subkey,11,4)
if vers = "0011" then vers_name = "Microsoft Office Professional Plus 2007" end if
if vers = "0012" then vers_name = "Microsoft Office Standard 2007" end if
if vers = "0013" then vers_name = "Microsoft Office Basic 2007" end if
if vers = "0014" then vers_name = "Microsoft Office Professional 2007" end if
if vers = "0015" then vers_name = "Microsoft Office Access 2007" end if
if vers = "0016" then vers_name = "Microsoft Office Excel 2007" end if
if vers = "0017" then vers_name = "Microsoft Office SharePoint Designer 2007" end if
if vers = "0018" then vers_name = "Microsoft Office PowerPoint 2007" end if
if vers = "0019" then vers_name = "Microsoft Office Publisher 2007" end if
if vers = "001A" then vers_name = "Microsoft Office Outlook 2007" end if
if vers = "001B" then vers_name = "Microsoft Office Word 2007" end if
if vers = "001C" then vers_name = "Microsoft Office Access Runtime 2007" end if
if vers = "0020" then vers_name = "Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats" end if
if vers = "0021" then vers_name = "Microsoft Visual Studio Web Authoring Component" end if
if vers = "0026" then vers_name = "Microsoft Expression Web" end if
if vers = "0029" then vers_name = "Microsoft Office Excel 2007" end if
if vers = "002B" then vers_name = "Microsoft Office Word 2007" end if
if vers = "002E" then vers_name = "Microsoft Office Ultimate 2007" end if
if vers = "002F" then vers_name = "Microsoft Office Home and Student 2007" end if
if vers = "0030" then vers_name = "Microsoft Office Enterprise 2007" end if
if vers = "0031" then vers_name = "Microsoft Office Professional Hybrid 2007" end if
if vers = "0033" then vers_name = "Microsoft Office Personal 2007" end if
if vers = "0035" then vers_name = "Microsoft Office Professional Hybrid 2007" end if
if vers = "0037" then vers_name = "Microsoft Office PowerPoint 2007" end if
if vers = "003A" then vers_name = "Microsoft Office Project Standard 2007" end if
if vers = "003B" then vers_name = "Microsoft Office Project Professional 2007" end if
if vers = "0044" then vers_name = "Microsoft Office InfoPath 2007" end if
if vers = "0051" then vers_name = "Microsoft Office Visio Professional 2007" end if
if vers = "0052" then vers_name = "Microsoft Office Visio Viewer 2007" end if
if vers = "0053" then vers_name = "Microsoft Office Visio Standard 2007" end if
if vers = "00A1" then vers_name = "Microsoft Office OneNote 2007" end if
if vers = "00A3" then vers_name = "Microsoft Office OneNote Home Student 2007" end if
if vers = "00A7" then vers_name = "Calendar Printing Assistant for Microsoft Office Outlook 2007" end if
if vers = "00A9" then vers_name = "Microsoft Office InterConnect 2007" end if
if vers = "00AF" then vers_name = "Microsoft Office PowerPoint Viewer 2007 (English)" end if
if vers = "00B0" then vers_name = "The Microsoft Save as PDF add-in" end if
if vers = "00B1" then vers_name = "The Microsoft Save as XPS add-in" end if
if vers = "00B2" then vers_name = "The Microsoft Save as PDF or XPS add-in" end if
if vers = "00BA" then vers_name = "Microsoft Office Groove 2007" end if
if vers = "00CA" then vers_name = "Microsoft Office Small Business 2007" end if
if vers = "00E0" then vers_name = "Microsoft Office Outlook 2007" end if
if vers = "10D7" then vers_name = "Microsoft Office InfoPath Forms Services" end if
if vers = "110D" then vers_name = "Microsoft Office SharePoint Server 2007" end if
get_sku_2007 = vers_name
end function
function get_sku_2010(subkey)
vers = mid(subkey,11,4)
if vers = "0011" then vers_name = "Microsoft Office Professional Plus 2010" end if
if vers = "0012" then vers_name = "Microsoft Office Standard 2010" end if
if vers = "0013" then vers_name = "Microsoft Office Basic 2010" end if
if vers = "0014" then vers_name = "Microsoft Office Professional 2010" end if
if vers = "0015" then vers_name = "Microsoft Office Access 2010" end if
if vers = "0016" then vers_name = "Microsoft Office Excel 2010" end if
if vers = "0017" then vers_name = "Microsoft Office SharePoint Designer 2010" end if
if vers = "0018" then vers_name = "Microsoft Office PowerPoint 2010" end if
if vers = "0019" then vers_name = "Microsoft Office Publisher 2010" end if
if vers = "001A" then vers_name = "Microsoft Office Outlook 2010" end if
if vers = "001B" then vers_name = "Microsoft Office Word 2010" end if
if vers = "001C" then vers_name = "Microsoft Office Access Runtime 2010" end if
if vers = "0020" then vers_name = "Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2010 File Formats" end if
if vers = "0026" then vers_name = "Microsoft Expression Web" end if
if vers = "0029" then vers_name = "Microsoft Office Excel 2010" end if
if vers = "002B" then vers_name = "Microsoft Office Word 2010" end if
if vers = "002E" then vers_name = "Microsoft Office Ultimate 2010" end if
if vers = "002F" then vers_name = "Microsoft Office Home and Student 2010" end if
if vers = "0030" then vers_name = "Microsoft Office Enterprise 2010" end if
if vers = "0031" then vers_name = "Microsoft Office Professional Hybrid 2010" end if
if vers = "0033" then vers_name = "Microsoft Office Personal 2010" end if
if vers = "0035" then vers_name = "Microsoft Office Professional Hybrid 2010" end if
if vers = "0037" then vers_name = "Microsoft Office PowerPoint 2010" end if
if vers = "003A" then vers_name = "Microsoft Office Project Standard 2010" end if
if vers = "003B" then vers_name = "Microsoft Office Project Professional 2010" end if
if vers = "003D" then vers_name = "Microsoft Office Professional 2010" end if
if vers = "0044" then vers_name = "Microsoft Office InfoPath 2010" end if
if vers = "0051" then vers_name = "Microsoft Office Visio Professional 2010" end if
if vers = "0052" then vers_name = "Microsoft Office Visio Viewer 2010" end if
if vers = "0053" then vers_name = "Microsoft Office Visio Standard 2010" end if
if vers = "0057" then vers_name = "Microsoft Office Visio Premium 2010" end if
if vers = "00A1" then vers_name = "Microsoft Office OneNote 2010" end if
if vers = "00A3" then vers_name = "Microsoft Office OneNote Home Student 2010" end if
if vers = "00A7" then vers_name = "Calendar Printing Assistant for Microsoft Office Outlook 2010" end if
if vers = "00A9" then vers_name = "Microsoft Office InterConnect 2010" end if
if vers = "00AF" then vers_name = "Microsoft Office PowerPoint Viewer 2010 (English)" end if
if vers = "00B0" then vers_name = "The Microsoft Save as PDF add-in" end if
if vers = "00B1" then vers_name = "The Microsoft Save as XPS add-in" end if
if vers = "00B2" then vers_name = "The Microsoft Save as PDF or XPS add-in" end if
if vers = "00BA" then vers_name = "Microsoft Office Groove 2010" end if
if vers = "00CA" then vers_name = "Microsoft Office Small Business 2010" end if
if vers = "00E0" then vers_name = "Microsoft Office Outlook 2010" end if
if vers = "10D7" then vers_name = "Microsoft Office InfoPath Forms Services" end if
if vers = "110D" then vers_name = "Microsoft Office SharePoint Server 2010" end if
get_sku_2010 = vers_name
end function
function get_release_type(value)
vers = mid(value,2,1)
if vers = "0" then release_type = "Any release before Beta 1" end if
if vers = "1" then release_type = "Beta 1" end if
if vers = "2" then release_type = "Beta 2" end if
if vers = "3" then release_type = "RC0" end if
if vers = "4" then release_type = "RC1/OEM Preview Release" end if
if vers = "5" then release_type = "Reserved - Not Defined by Microsoft" end if
if vers = "6" then release_type = "Reserved - Not Defined by Microsoft" end if
if vers = "7" then release_type = "Reserved - Not Defined by Microsoft" end if
if vers = "8" then release_type = "Reserved - Not Defined by Microsoft" end if
if vers = "9" then release_type = "RTM (first shipped version)" end if
if vers = "A" then release_type = "SR1 (unused if the product code is not changed after RTM)" end if
if vers = "B" then release_type = "SR2 (unused if the product code is not changed after RTM)" end if
if vers = "C" then release_type = "SR3 (unused if the product code is not changed after RTM)" end if
get_release_type = release_type
end function
function get_edition_type(value)
vers = mid(value,3,1)
if vers = "0" then release_type = "Enterprise" end if
if vers = "1" then release_type = "Retail/OEM" end if
if vers = "2" then release_type = "Trial" end if
get_edition_type = release_type
end function
function getkey(rpk,ver)
' location of key in DigitalProductID changed in Office 2010.
' http://code.google.com/p/msoffice-product-key-decoder/
if ver = "1" then
rpkOffset = 52
else
rpkOffset = 808
end if
i=28
szPossibleChars = "BCDFGHJKMPQRTVWXY2346789"
do
dwAccumulator=0 : j=14
do
dwAccumulator = dwAccumulator * 256
dwAccumulator = rpk(j+rpkOffset) + dwAccumulator
rpk(j+rpkOffset) = (dwAccumulator\24) and 255
dwAccumulator = dwAccumulator Mod 24
j = j - 1
loop while j>=0
i=i-1 :
szProductKey = mid(szPossibleChars,dwAccumulator+1,1) & szProductKey
if (((29-i) Mod 6)=0) and (i<>-1) then
i = i - 1 : szProductKey = "-" & szProductKey
end if
loop while i>=0
getkey = szProductKey
end function
Function GetSN(sComputer,sRoot,sKeyPath,sValueName)
On Error Resume Next
Set objRegistry = GetObject("winmgmts:\\" & sComputer & "\root\default:StdRegProv")
If Err.Number = 0 Then
'On Error Resume Next
'HexBuf = WshShell.RegRead(sRegLocation)
intReturn = objRegistry.GetBinaryValue(sRoot, sKeyPath, sValueName, Hexbuf)
If intReturn = 0 Then
'If Err.Number = 0 Then
'On Error GoTo 0
For l = LBound(HexBuf) To UBound(HexBuf)
tmp=tmp & " "& Hex (HexBuf(l))
Next
StartOffset = 52
EndOffset =67
Dim Digits (24)
Digits (0) = "B" : Digits (1) = "C": Digits (2) = "D": Digits (3) = "F":
Digits (4) = "G": Digits (5) = "H": Digits (6) = "J": Digits (7) = "K":
Digits (8) = "M": Digits (9) = "P": Digits (10) = "Q": Digits (11) = "R":
Digits (12) = "T": Digits (13) = "V": Digits (14) = "W": Digits (15) = "X":
Digits (16) = "Y": Digits (17) = "2": Digits (18) = "3": Digits (19) = "4":
Digits (20) = "6" : Digits (21) = "7" : Digits (22) = "8": Digits (23) = "9"
dLen = 29
sLen = 15
Dim HexDigitalPID (15)
Dim Des (30)
For i = StartOffset To EndOffset
HexDigitalPID (i-StartOffset) = HexBuf(i)
tmp2=tmp2 & " "& Hex (HexDigitalPID(i-StartOffset))
Next
KEYSTRING =""
For i=dLen-1 To 0 Step -1
If ((i + 1) mod 6) = 0 Then
Des (i) = "-"
KEYSTRING =KEYSTRING & "-"
Else
HN = 0
For N = (sLen -1) To 0 Step -1
Value = ( (HN *2^8 ) Or HexDigitalPID (N))
HexDigitalPID (N) = Value \ 24
HN = (Value mod 24)
Next
Des(i) = Digits(HN)
KEYSTRING =KEYSTRING & Digits(HN)
End If
Next
KEYSTRING2 = StrReverse (KEYSTRING)
GetSN = KEYSTRING2
Else
'Err.Clear
'On Error GoTo 0
'GetSN = sProduct & " is not installed"
End If
Else
Err.Clear
On Error GoTo 0
'GetSN = "Error reading registry of " & sComputer
End If
End Function
function get_adobe(key)
'This script decrypts any adobe serial stored in
'the windows registry into a key that can be used
Dim strValueName, strEncryptedKey
Dim strDecryptedKey, CipherIndex, i, strFormattedKey
' Adobe Substitution Cipher Key
Dim AdobeSubCipherKey(24)
AdobeSubCipherKey(0) = ""
AdobeSubCipherKey(1) = "0000000001"
AdobeSubCipherKey(2) = "5038647192"
AdobeSubCipherKey(3) = "1426053789"
AdobeSubCipherKey(4) = "2604371895"
AdobeSubCipherKey(5) = "4753896210"
AdobeSubCipherKey(6) = "8145962073"
AdobeSubCipherKey(7) = "0319728564"
AdobeSubCipherKey(8) = "7901235846"
AdobeSubCipherKey(9) = "7901235846"
AdobeSubCipherKey(10) = "0319728564"
AdobeSubCipherKey(11) = "8145962073"
AdobeSubCipherKey(12) = "4753896210"
AdobeSubCipherKey(13) = "2604371895"
AdobeSubCipherKey(14) = "1426053789"
AdobeSubCipherKey(15) = "5038647192"
AdobeSubCipherKey(16) = "3267408951"
AdobeSubCipherKey(17) = "5038647192"
AdobeSubCipherKey(18) = "2604371895"
AdobeSubCipherKey(19) = "8145962073"
AdobeSubCipherKey(20) = "7901235846"
AdobeSubCipherKey(21) = "3267408951"
AdobeSubCipherKey(22) = "1426053789"
AdobeSubCipherKey(23) = "4753896210"
AdobeSubCipherKey(24) = "0319728564"
strEncryptedKey = key
' We will build the decrypted key here
' Take the numeric value of char at index i of the encrypted
' key. That value provides an index within the string
' AdobeSubCipherKey(i). The char located at that index
' is the properly decrypted char.
For i = 1 To 24
CipherIndex = Cint(Mid(strEncryptedKey,i,1)) + 1
strDecryptedKey = strDecryptedKey & Mid(AdobeSubCipherKey(i),CipherIndex,1)
Next
'Include dashes for readability
get_adobe = Mid(strDecryptedKey,1,4) & "-" & Mid(strDecryptedKey,5,4) & "-" & Mid(strDecryptedKey,9,4) & _
"-" & Mid(strDecryptedKey,13,4) & "-" & Mid(strDecryptedKey,17,4) & "-" & Mid(strDecryptedKey,21,4)
end function
function CSVParser(CSVDataToProcess)
'Declaring variables for text delimiter and text qualifyer
dim TextDelimiter, TextQualifyer
'Declaring the variables used in determining action to be taken
dim ProcessQualifyer, NewRecordCreate
'Declaring variables dealing with input string
dim CharMaxNumber, CharLocation, CharCurrentVal, CharCounter, CharStorage
'Declaring variables that handle array duties
dim CSVArray(), CSVArrayCount
'Setting default values for various variables
TextDelimiter = "," '<- Text delimiter is a comma
TextQualifyer = Chr(34) '<- Chr(34) is the ascii code for "
ProcessQualifyer = False '<- Determining how record should be processed
CharMaxNumber = Len(CSVDataToProcess) '<- Calculating no. of characters in variable
NewRecordCreate = 0 '<- Determining how to handle record at different stages of operation
' 0 = Don't create new record
' 1 = Write data to existing record
' 2 = Close record and open new one
CSVArrayCount = 0 '<- Priming the array counter
Redim Preserve CSVArray(CSVArrayCount) '<- Initializing the array
CharCounter = 0 '<- Record character counter
for CharLocation = 1 to CharMaxNumber 'Starting the main loop
'Retrieving the next character in sequence from CSVDataToProcess
CharCurrentVal = Mid(CSVDataToProcess, CharLocation, 1)
'This will figure out if the record uses a text qualifyer or not
if CharCurrentVal = TextQualifyer and CharCounter = 0 then
ProcessQualifyer = True
CharCurrentVal = ""
end if
'Advancing the record 'letter count' counter
CharCounter = CharCounter + 1
'Choosing data extraction method (text qualifyer or no text qualifyer)
if ProcessQualifyer = True then
'This section handles records with a text qualifyer and text delimiter
'It is also handles the special case scenario, where the qualifyer is
'part of the data. In the CSV file, a double quote represents a single
'one ie. "" = "
if Len(CharStorage) <> 0 then
if CharCurrentVal = TextDelimiter then
CharStorage = ""
ProcessQualifyer = False
NewRecordCreate = 2
else
CharStorage = ""
NewRecordCreate = 1
end if
else
if CharCurrentVal = TextQualifyer then
CharStorage = CharStorage & CharCurrentVal
NewRecordCreate = 0
else
NewRecordCreate = 1
end if
end if
'This section handles a regular CSV record.. without the text qualifyer
else
if CharCurrentVal = TextDelimiter then
NewRecordCreate = 2
else
NewRecordCreate = 1
end if
end if
'Writing the data to the array
select case NewRecordCreate
'This section just writes the info to the array
case 1
CSVArray(CSVArrayCount) = CSVArray(CSVArrayCount) & CharCurrentVal
'This section closes the current record and creates a new one
case 2
CharCounter = 0
CSVArrayCount = CSVArrayCount + 1
redim preserve CSVArray(CSVArrayCount)
end select
next
'Finishing Up
CSVParser = CSVArray
end function