[quote="A_Hull"]If you give me the diffs between the current SVN and your current NT version, then I will add them in (now that I have fixed by SVN upload issue ).
Ok here you go, I am still a little green with the diff generation. I notice it compare to 858 version base, so it includes some other edits since then.
audit.vbs changes
[code] Index: //apache/c$/xampp/htdocs/openaudit/scripts/audit.vbs =================================================================== --- //apache/c$/xampp/htdocs/openaudit/scripts/audit.vbs (revision 858) +++ //apache/c$/xampp/htdocs/openaudit/scripts/audit.vbs (working copy) @@ -1,4 +1,4 @@ -this_config_url = "http://localhost/openaudit/list_export_config.php" +this_config_url = "http://xxxxx.xxxxxxxxx.com/list_export_config.php" ''''''''''''''''''''''''''''''''''' ' Open Audit ' ' Software and Hardware Inventory ' @@ -14,6 +14,17 @@ Dim email_from Dim email_failed Dim email_server + +Dim email_port +Dim email_auth +Dim email_user_id +Dim email_user_pwd +Dim email_use_ssl +Dim email_timeout + + + + Dim audit_local_domain Dim local_domain Dim sql @@ -129,7 +140,7 @@ '''''''''''''''''''''''''''''''''''' -' Uncomment the 3 lines below to ' +' Uncomment the 3 sections below to ' ' have the script ask for a PC ' ' to audit (name or IP) ' '''''''''''''''''''''''''''''''''''' @@ -137,6 +148,18 @@ 'Wscript.Echo "Input PC Name: " & strAnswer 'strComputer = strAnswer +'strAnswer = InputBox("PC User:", "Audit Script") +'Wscript.Echo "Input PC User Name: " & strAnswer +'strUser = strAnswer + +'strAnswer = InputBox("PC User Password:", "Audit Script") +'Wscript.Echo "Input Password: " & strAnswer +'strPass = strAnswer + + + + + '''''''''''''''''''''''''''''''''''' ' Check that softwarefiles.xml ' ' is correct ' @@ -228,6 +251,9 @@ ' Audit the local domain, if requested ' '''''''''''''''''''''''''''''''''''''''' if audit_local_domain = "y" then + if domain_type = "nt" then + comparray = GetDomainComputers(local_domain) + elseif domain_type = "ldap" then Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") @@ -260,6 +286,7 @@ wscript.echo "Number of systems retrieved from ldap: " & Ubound(comparray) wscript.echo "--------------" end if +end if For i = 0 To Ubound(comparray) ' For i = 118 To 128 @@ -357,22 +384,36 @@ ' Send an email of failed audits ' ' if there are any ' '''''''''''''''''''''''''''''''''' + if email_failed <> "" then + On Error Resume Next + wscript.echo "This system failed to audit." Set objEmail = CreateObject("CDO.Message") objEmail.From = email_from objEmail.To = email_to - objEmail.Subject = "Failed Open Audits." + 'objEmail.Sender = email_sender + objEmail.Subject = "Open-AudIT - Failed Audits." objEmail.Textbody = "The following systems failed to audit: " & vbCRLF & email_failed objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = email_server - objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = email_port + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = email_auth + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = email_user_id + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = email_user_pwd + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = email_use_ssl + objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = email_timeout objEmail.Configuration.Fields.Update objEmail.Send + if Err.Number <> 0 then + wscript.echo "Error sending email: " & Err.Description + else wscript.echo "Email sent." end if + Err.Clear end if ' Exit the script wscript.quit + function Audit(strComputer) start_time = Timer dim dt : dt = Now() @@ -435,71 +476,205 @@ ''''''''''''''''''''''''''' ' Network Information ' ''''''''''''''''''''''''''' + +dim net_mac, net_ip_enabled, net_index, net_service_name, net_description, net_dhcp_enabled, net_dhcp_server +dim net_dhcp_lease_obtained, net_dhcp_lease_expires, net_dns_host_name, net_dns_server(2), net_dns_domain +dim net_dns_domain_suffix(2), net_dns_domain_reg_enabled, net_dns_domain_full_reg_enabled, net_ip(2) +dim net_ip_subnet(2), net_wins_primary, net_wins_secondary, net_wins_lmhosts_enabled, net_netbios_options +dim net_adapter_type, net_manufacturer, net_connection_id, net_connection_status, net_speed, net_gateway(2) +dim net_gateway_metric(2), net_ip_metric, net_ip_address, net_ip_mask, is_installed + comment = "Network Info" if verbose = "y" then wscript.echo comment end if On Error Resume Next -Set colItems = objWMIService.ExecQuery("select * from win32_networkadapterconfiguration WHERE IPEnabled='TRUE' " _ - & "AND ServiceName<>'AsyncMac' AND ServiceName<>'VMnetx' " _ - & "AND ServiceName<>'VMnetadapter' AND ServiceName<>'Rasl2tp' " _ - & "AND ServiceName<>'msloop' " _ + +Set objWMIService_WMI = GetObject("winmgmts:\\" & strComputer & "\root\WMI") +Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration " _ + & "WHERE 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 ServiceName<>'' AND Description<>'PPP Adapter.'",,48) + & "AND ServiceName<>'NdisIP' AND Description<>'PPP Adapter.'",,48) For Each objItem in colItems - net_gateway = objItem.DefaultIPGateway(0) - net_ip = objItem.IPAddress(0) - net_mac = objItem.MACAddress + net_index = objItem.Index net_description = objItem.Description - net_dhcp_enabled = objItem.DHCPEnabled - net_dhcp_server = objItem.DHCPServer - net_dns_host_name = objItem.DNSHostName - if isarray(objItem.DNSServerSearchOrder) then - net_dns_server = objItem.DNSServerSearchOrder(0) - net_dns_server_2 = objItem.DNSServerSearchOrder(1) - end if - net_ip_subnet = objItem.IPSubnet(0) - net_wins_primary = objItem.WINSPrimaryServer - net_wins_secondary = objItem.WINSSecondaryServer - Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter WHERE MACAddress='" & objItem.MACAddress & "'",,48) + is_installed = "false" + Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter WHERE Index='" & net_index & "'",,48) For Each objItem2 in colItems2 - net_adapter_type = objItem2.AdapterType - net_manufacturer = objItem2.Manufacturer + if (not isnull(objItem2.Manufacturer) or objItem2.Manufacturer <> "") then + ' Found a currently installed NIC + is_installed = "true" + net_manufacturer = objItem2.Manufacturer + net_adapter_type = objItem2.AdapterType + net_connection_id = objItem2.NetConnectionId + net_connection_status = objItem2.NetConnectionStatus + if net_connection_status = "2" then + ' Found a connected NIC: detecting link speed + Set colItems3 = objWMIService_WMI.ExecQuery("Select * from MSNdis_LinkSpeed ",,48) + For Each objItem3 in colItems3 + if objItem3.InstanceName = net_description then net_speed = objItem3.NdisLinkSpeed end if + Next + end if + end if Next - ' Below is to account for a NULL in various items - if net_ip = "" then net_ip = "0.0.0.0" - if isnull(net_dns_server_2) then net_dns_server_2 = "none" - if isnull(net_dhcp_server) then net_dhcp_server = "none" - if net_dhcp_server = "" then net_dhcp_server = "none" - if isnull(net_dns_server) then net_dns_server = "none" - if isnull(net_ip_subnet) then net_ip_subnet = "none" - net_description = clean(net_description) - ' IP Address padded with zeros so it sorts properly - MyIP = Split(net_ip, ".", -1, 1) - if MyIP(0) <> "169" AND MyIP(1) <> "254" then - MyIP(0) = right("000" & MyIP(0),3) - MyIP(1) = right("000" & MyIP(1),3) - MyIP(2) = right("000" & MyIP(2),3) - MyIP(3) = right("000" & MyIP(3),3) - net_ip = MyIP(0) & "." & MyIP(1) & "." & MyIP(2) & "." & MyIP(3) - if net_ip <> "000.000.000.000" then net_ip_address = net_ip end if - end if - if net_dhcp_server <> "255.255.255.255" then - form_input = "network^^^" & net_mac & "^^^" & net_description & "^^^" & net_dhcp_enabled _ - & "^^^" & net_dhcp_server & "^^^" & net_dns_host_name & "^^^" & net_dns_server & "^^^" & net_dns_server_2 _ - & "^^^" & net_ip & "^^^" & net_ip_subnet & "^^^" & net_wins_primary _ - & "^^^" & net_wins_secondary & "^^^" & net_adapter_type & "^^^" & net_manufacturer & "^^^" & net_gateway & "^^^" -' This section replaced by the above, from the forums -' http://www.open-audit.org/phpBB3/viewtopic.php?f=10&t=2240 -' form_input = "network^^^" & net_mac & "^^^" & net_description & "^^^" & net_dhcp_enabled _ -' & "^^^" & net_dhcp_server & "^^^" & net_dns_host_name & "^^^" & net_dns_server _ -' & "^^^" & net_ip & "^^^" & net_ip_subnet & "^^^" & net_wins_primary _ -' & "^^^" & net_wins_secondary & "^^^" & net_adapter_type & "^^^" & net_manufacturer & "^^^" & net_gateway & "^^^" - entry form_input,comment,objTextFile,oAdd,oComment - form_input = "" - if net_mac_uuid = "" then net_mac_uuid = net_mac end if - end if + if is_installed = "true" then + net_mac = objItem.MACAddress + net_ip_enabled = objItem.IPEnabled + net_service_name = objItem.ServiceName + net_dhcp_enabled = objItem.DHCPEnabled + net_dhcp_server = objItem.DHCPServer + net_dhcp_lease_obtained = objItem.DHCPLeaseObtained + net_dhcp_lease_expires = objItem.DHCPLeaseExpires + net_dns_host_name = objItem.DNSHostName + For i = LBound(objItem.DNSServerSearchOrder) to UBound(objItem.DNSServerSearchOrder) + if i > 2 then exit for End if + net_dns_server(i) = objItem.DNSServerSearchOrder(i) + Next + net_dns_domain = objItem.DNSDomain + For i = LBound(objItem.DNSDomainSuffixSearchOrder) to UBound(objItem.DNSDomainSuffixSearchOrder) + if i > 2 then exit for End if + net_dns_domain_suffix(i) = objItem.DNSDomainSuffixSearchOrder(i) + Next + net_dns_domain_reg_enabled = objItem.DomainDNSRegistrationEnabled + net_dns_domain_full_reg_enabled = objItem.FullDNSRegistrationEnabled + For i = LBound(objItem.IPAddress) to UBound(objItem.IPAddress) + if i > 2 then exit for End if + net_ip(i) = objItem.IPAddress(i) + Next + For i = LBound(objItem.IPSubnet) to UBound(objItem.IPSubnet) + if i > 2 then exit for End if + net_ip_subnet(i) = objItem.IPSubnet(i) + Next + net_wins_primary = objItem.WINSPrimaryServer + net_wins_secondary = objItem.WINSSecondaryServer + net_wins_secondary = objItem.WINSSecondaryServer + net_wins_lmhosts_enabled = objItem.WINSEnableLMHostsLookup + net_netbios_options = objItem.TcpipNetbiosOptions + For i = LBound(objItem.DefaultIPGateway) to UBound(objItem.DefaultIPGateway) + if i > 2 then exit for End if + net_gateway(i) = objItem.DefaultIPGateway(i) + Next + For i = LBound(objItem.GatewayCostMetric) to UBound(objItem.GatewayCostMetric) + if i > 2 then exit for End if + net_gateway_metric(i) = objItem.GatewayCostMetric(i) + Next + net_ip_metric = objItem.IpConnectionMetric + + ' Below is to account for a NULL in various items or converting values + if (isnull(net_mac) or net_mac = "") then net_mac = "unknown" End if + if (isnull(net_ip_enabled) or net_ip_enabled = "") then net_ip_enabled = "unknown" End if + if (isnull(net_description) or net_description = "") then net_description = "unknown" End if + if (isnull(net_dhcp_enabled) or net_dhcp_enabled = "") then net_dhcp_enabled = "false" End if + if (isnull(net_dhcp_server) or net_dhcp_server = "") then net_dhcp_server = "none" End if + if isnull(net_dhcp_lease_obtained) then net_dhcp_lease_obtained = "" End if + if isnull(net_dhcp_lease_expires) then net_dhcp_lease_expires = "" End if + if (isnull(net_dns_host_name) or net_dns_host_name = "") then net_dns_host_name = "none" End if + if (isnull(net_dns_domain) or net_dns_domain = "") then net_dns_domain = "none" End if + if (isnull(net_dns_domain_reg_enabled) or net_dns_domain_reg_enabled = "") then net_dns_domain_reg_enabled = "false" End if + if (isnull(net_dns_domain_full_reg_enabled) or net_dns_domain_full_reg_enabled = "") then net_dns_domain_full_reg_enabled = "false" End if + if (isnull(net_wins_primary) or net_wins_primary = "") then net_wins_primary = "none" End if + if (isnull(net_wins_secondary) or net_wins_secondary = "") then net_wins_secondary = "none" End if + if (isnull(net_wins_lmhosts_enabled) or net_wins_lmhosts_enabled = "") then net_wins_lmhosts_enabled = "false" End if + Select Case net_netbios_options + Case "0" net_netbios_options = "defaults" + Case "1" net_netbios_options = "enabled" + Case "2" net_netbios_options = "disabled" + Case Else net_netbios_options = "unknown" + End Select + if (isnull(net_adapter_type) or net_adapter_type = "") then net_adapter_type = "unknown" End if + if (isnull(net_connection_id) or net_connection_id = "") then net_connection_id = "unknown" End if + Select Case net_connection_status + Case "0" net_connection_status = "Disconnected" + Case "1" net_connection_status = "Connecting" + Case "2" net_connection_status = "Connected" + Case "3" net_connection_status = "Disconnecting" + Case "4" net_connection_status = "Hardware not present" + Case "5" net_connection_status = "Hardware disabled" + Case "6" net_connection_status = "Hardware malfunction" + Case "7" net_connection_status = "Media disconnected" + Case "8" net_connection_status = "Authenticating" + Case "9" net_connection_status = "Authentication succeeded" + Case "10" net_connection_status = "Authentication failed" + Case "11" net_connection_status = "Invalid address" + Case "12" net_connection_status = "Credentials required" + Case Else net_connection_status = "unknown" + End Select + if (isnull(net_speed) or net_speed = "") then + net_speed = "unknown" + else net_speed = int(net_speed)/10000 End if + if (isnull(net_ip_metric) or net_ip_metric = "") then net_ip_metric = "unknown" End if + For i = 0 to 2 + if (isnull(net_dns_server(i)) or net_dns_server(i) = "") then net_dns_server(i) = "none" End if + if (isnull(net_dns_domain_suffix(i)) or net_dns_domain_suffix(i) = "") then net_dns_domain_suffix(i) = "none" End if + if (isnull(net_ip(i)) or net_ip(i) = "") then net_ip(i) = "0.0.0.0" End if + if (isnull(net_ip_subnet(i)) or net_ip_subnet(i) = "") then net_ip_subnet(i) = "none" End if + if (isnull(net_gateway(i)) or net_gateway(i) = "") then net_gateway(i) = "none" End if + if (isnull(net_gateway_metric(i)) or net_gateway_metric(i) = "") then net_gateway_metric(i) = "none" End if + Next + + ' IP Address are padded with zeros so they sort properly + MyIP = Split(net_ip(0), ".", -1, 1) + if MyIP(0) <> "169" AND MyIP(1) <> "254" then + MyIP(0) = right("000" & MyIP(0),3) + MyIP(1) = right("000" & MyIP(1),3) + MyIP(2) = right("000" & MyIP(2),3) + MyIP(3) = right("000" & MyIP(3),3) + net_ip(0) = MyIP(0) & "." & MyIP(1) & "." & MyIP(2) & "." & MyIP(3) + ' The first detected IP address / Subnet mask become the system IP/Mask + if (net_ip(0) <> "000.000.000.000" and net_ip_address = "") then + net_ip_address = net_ip(0) + net_ip_mask = net_ip_subnet(0) + elseif net_ip(0) = "000.000.000.000" then net_ip(0) = "none" end if + end if + MyIP = Split(net_ip(1), ".", -1, 1) + if MyIP(0) <> "169" AND MyIP(1) <> "254" then + MyIP(0) = right("000" & MyIP(0),3) + MyIP(1) = right("000" & MyIP(1),3) + MyIP(2) = right("000" & MyIP(2),3) + MyIP(3) = right("000" & MyIP(3),3) + net_ip(1) = MyIP(0) & "." & MyIP(1) & "." & MyIP(2) & "." & MyIP(3) + if net_ip(1) = "000.000.000.000" then net_ip(1) = "none" end if + end if + MyIP = Split(net_ip(2), ".", -1, 1) + if MyIP(0) <> "169" AND MyIP(1) <> "254" then + MyIP(0) = right("000" & MyIP(0),3) + MyIP(1) = right("000" & MyIP(1),3) + MyIP(2) = right("000" & MyIP(2),3) + MyIP(3) = right("000" & MyIP(3),3) + net_ip(2) = MyIP(0) & "." & MyIP(1) & "." & MyIP(2) & "." & MyIP(3) + if net_ip(2) = "000.000.000.000" then net_ip(2) = "none" end if + end if + + if net_dhcp_server <> "255.255.255.255" then + form_input = "network^^^" & net_mac & "^^^" & net_description & "^^^" & net_dhcp_enabled & "^^^" _ + & net_dhcp_server & "^^^" & net_dns_host_name & "^^^" & net_dns_server(0) & "^^^" _ + & net_dns_server(1) & "^^^" & net_ip(0) & "^^^" & net_ip_subnet(0) & "^^^" _ + & net_wins_primary & "^^^" & net_wins_secondary & "^^^" & net_adapter_type & "^^^" _ + & net_manufacturer & "^^^" & net_gateway(0) & "^^^" & net_ip_enabled & "^^^" _ + & net_index & "^^^" & net_service_name & "^^^" & net_dhcp_lease_obtained & "^^^" _ + & net_dhcp_lease_expires & "^^^" & net_dns_server(2) & "^^^" & net_dns_domain & "^^^" _ + & net_dns_domain_suffix(0) & "^^^" & net_dns_domain_suffix(1) & "^^^" & net_dns_domain_suffix(2) & "^^^" _ + & net_dns_domain_reg_enabled & "^^^" & net_dns_domain_full_reg_enabled & "^^^" & net_ip(1) & "^^^" _ + & net_ip_subnet(1) & "^^^" & net_ip(2) & "^^^" & net_ip_subnet(2) & "^^^" _ + & net_wins_lmhosts_enabled & "^^^" & net_netbios_options & "^^^" & net_gateway_metric(0) & "^^^" _ + & net_gateway(1) & "^^^" & net_gateway_metric(1) & "^^^" & net_gateway(2) & "^^^" _ + & net_gateway_metric(2) & "^^^" & net_ip_metric & "^^^" & net_connection_id & "^^^" _ + & net_connection_status & "^^^" & net_speed & "^^^" + entry form_input,comment,objTextFile,oAdd,oComment + form_input = "" + erase net_dns_server + erase net_dns_domain_suffix + erase net_ip + erase net_ip_subnet + erase net_gateway + erase net_gateway_metric + ' The first valid MAC Address becomes the MAC_UUID + if (net_mac <> "unknown" and net_mac_uuid = "") then net_mac_uuid = net_mac end if + end if + end if 'is_installed = "true" Next On Error Resume Next @@ -525,7 +700,7 @@ if isnull(net_user_name) then oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", net_user_name if isnull(net_user_name) then net_user_name = "" end if -end if +end if if isnull(net_client_site_name) then net_client_site_name = "" end if if isnull(net_domain_controller_address) then net_domain_controller_address = "" end if @@ -537,6 +712,8 @@ entry form_input,comment,objTextFile,oAdd,oComment form_input = "" + + ''''''''''''''''' ' Make the UUID ' ''''''''''''''''' @@ -709,7 +886,7 @@ oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>Description: </td><td>" & system_description & "</td></tr>" oIE.document.WriteLn "<tr><td>MAC Address: </td><td>" & net_mac & "</td></tr>" oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>IP Address: </td><td> " & net_ip_address & "</td></tr>" - oIE.document.WriteLn "<tr><td>Subnet: </td><td>" & net_ip_subnet & "</td></tr>" + oIE.document.WriteLn "<tr><td>Subnet: </td><td>" & net_ip_mask & "</td></tr>" oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>DHCP Enabled: </td><td>" & net_dhcp_enabled & "</td></tr>" oIE.document.WriteLn "<tr><td>DHCP Server: </td><td>" & net_dhcp_server & "</td></tr>" oIE.document.WriteLn "<tr bgcolor=""#F1F1F1""><td>WINS Server: </td><td>" & net_wins_primary & "</td></tr>" @@ -769,7 +946,9 @@ Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure",,48) For Each objSMBIOS in colSMBIOS -bios_asset = objSMBIOS.SMBIOSAssetTag + if bios_asset = "" then + bios_asset = objSMBIOS.SMBIOSAssetTag + end if Next Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48) @@ -1222,51 +1401,76 @@ oIE.document.WriteLn "<tr><td>Hard Drive Partitions: </td><td>" & clean(objItem.Partitions) & "</td></tr>" end if Next + ''''''''''''''''''''''''''' + ' Partition Information ' + ''''''''''''''''''''''''''' + comment = "Partition Info" + if verbose = "y" then + wscript.echo comment + end if -''''''''''''''''''''''''''' -' Partition Information ' -''''''''''''''''''''''''''' -comment = "Partition Info" -if verbose = "y" then - wscript.echo comment -end if + ' Get the LogicalDisk's Path + strQueryFields = "DeviceID,Caption,FileSystem,FreeSpace,Size,VolumeName" + Set objEnumLogicalDisk = objWMIService.ExecQuery _ + ("Select " & strQueryFields & " from Win32_LogicalDisk where DriveType = 3", "WQL", 0) + ' Get the DiskPartition's path + strQueryFields = "Bootable,BootPartition,DeviceID,DiskIndex,Index,PrimaryPartition" + Set objEnumDiskPartition = objWMIService.ExecQuery _ + ("Select " & strQueryFields & " from Win32_DiskPartition", "WQL", 0) + For Each objItem in objEnumLogicalDisk + partition_caption = objItem.Caption + partition_file_system = objItem.FileSystem + partition_free_space = 0 + partition_free_space = int(objItem.FreeSpace /1024 /1024) + partition_size = 0 + partition_size = int(objItem.Size /1024 /1024) + partition_volume_name = objItem.VolumeName + partition_percent = 0 + partition_percent = round(((partition_size - partition_free_space) / partition_size) * 100 ,0) + + ' Associate with Device_ID in Win32_DiskPartition using objLogicalDiskToPartition - On Error Resume Next - Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskPartition WHERE DriveType=3",,48) - For Each objItem in colItems - partition_bootable = objItem.Bootable - if ((partition_bootable <> "True") OR isnull(partition_bootable)) then partition_bootable = "False" end if - partition_boot_partition = objItem.BootPartition - if ((partition_boot_partition <> "True") OR isnull(partition_boot_partition)) then partition_boot_partition = "False" end if - partition_device_id = objItem.DeviceID - partition_disk_index = objItem.DiskIndex - partition_index = objItem.Index - partition_primary_partition = objItem.PrimaryPartition - Next - On Error Resume Next - Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3",,48) - For Each objItem in colItems - partition_caption = objItem.Caption - partition_file_system = objItem.FileSystem - partition_free_space = 0 - partition_free_space = int(objItem.FreeSpace /1024 /1024) - partition_size = 0 - partition_size = int(objItem.Size /1024 /1024) - partition_volume_name = objItem.VolumeName - partition_percent = 0 - partition_percent = round(((partition_size - partition_free_space) / partition_size) * 100 ,0) + For Each objDiskPartition in objEnumDiskPartition + ' This is expected to fail once in a while since we are + ' concatonating a possible path to avoid hitting the floppy + On Error Resume Next + ' Associate the two sets + Set objLogicalDiskToPartition = objWMIService.Get _ + (Fixpath(objItem.Path_.relpath,objDiskPartition.path_.relpath), 0) + If Err.Number = 0 Then + partition_bootable = objDiskPartition.Bootable + if isnull(partition_bootable) then partition_bootable = "False" end if + partition_boot_partition = objDiskPartition.BootPartition + if isnull(partition_boot_partition) then partition_boot_partition = "False" end if + partition_device_id = objDiskPartition.DeviceID + partition_disk_index = objDiskPartition.DiskIndex + partition_index = objDiskPartition.Index + partition_primary_partition = objDiskPartition.PrimaryPartition + 'wscript.echo objLogicalDiskToPartition.path_.relpath + splitpath = split(objLogicalDiskToPartition.path_.relpath,"=") + LogicalDisk_DeviceID = "" + 'LogicalDisk_DeviceID = splitpath(ubound(splitpath)) + LogicalDisk_DeviceID = splitpath(2) + LogicalDisk_DeviceID = replace(LogicalDisk_DeviceID,"\","") + LogicalDisk_DeviceID = replace(LogicalDisk_DeviceID,"""","") + 'wscript.echo LogicalDisk_DeviceID & VBCRLF + Else + Err.Clear + End If + On Error Goto 0: + ' END Associate with Device_ID in Win32_DiskPartition using objLogicalDiskToPartition + Next + form_input = "partition^^^" & partition_bootable & "^^^" & partition_boot_partition & "^^^" _ + & partition_device_id & "^^^" & partition_disk_index & "^^^" _ + & partition_index & "^^^" & partition_percent & "^^^" _ + & partition_primary_partition & "^^^" & partition_caption & "^^^" _ + & partition_file_system & "^^^" & partition_free_space & "^^^" _ + & partition_size & "^^^" & partition_volume_name & "^^^" + entry form_input,comment,objTextFile,oAdd,oComment + form_input = "" + Next - form_input = "partition^^^" & partition_bootable & "^^^" & partition_boot_partition & "^^^" _ - & partition_device_id & "^^^" & partition_disk_index & "^^^" _ - & partition_percent & "^^^" & partition_primary_partition & "^^^" _ - & partition_caption & "^^^" & partition_file_system & "^^^" _ - & partition_free_space & "^^^" & partition_size & "^^^" _ - & partition_volume_name & "^^^" - entry form_input,comment,objTextFile,oAdd,oComment - form_input = "" -Next - ''''''''''''''''''''''''''''''''' ' SCSI Cards ' ''''''''''''''''''''''''''''''''' @@ -1698,7 +1902,7 @@ ''''''''''''''''' ' AV Settings ' ''''''''''''''''' -if (ServicePack = "2" AND SystemBuildNumber = "2600") then +if ((ServicePack = "2" AND SystemBuildNumber = "2600") OR (SystemBuildNumber = "6000")) then Set objWMIService_AV = GetObject("winmgmts:\\" & strComputer & "\root\SecurityCenter") comment = "AV - XP sp2 Settings" if verbose = "y" then @@ -2227,10 +2431,10 @@ ''''''''''''''''''''''''''' -'XP SP2 Firewall Settings ' +'Windows Firewall Settings ' ''''''''''''''''''''''''''' -if (ServicePack = "2" AND SystemBuildNumber = "2600") then - comment = "Firewall Settings" +if ((ServicePack = "2" AND SystemBuildNumber = "2600") OR (SystemBuildNumber = "3790" AND ServicePack = "1" OR ServicePack = "2") OR (SystemBuildNumber = "6000")) then + comment = "Windows Firewall Settings" if verbose = "y" then wscript.echo comment end if @@ -2362,7 +2566,37 @@ if verbose = "y" then wscript.echo comment end if + '''''''''''''''''''''''''''''''' +' MS CD Keys for Office 2007 ' +'''''''''''''''''''''''''''''''' +strKeyPath = "SOFTWARE\Microsoft\Office\12.0\Registration" +oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys +For Each subkey In arrSubKeys + name_2007 = get_sku_2007(subkey) + release_type = get_release_type(subkey) + edition_type = get_edition_type(subkey) + path = strKeyPath & "\" & subkey + strOffXPRU = "HKLM\" & path & "\DigitalProductId" + subKey = "DigitalProductId" + oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key + if IsNull(key) then + else + strOffXPRUKey=GetKey(key) + form_input = "ms_keys^^^" & name_2007 & "^^^" _ + & strOffXPRUKey & "^^^" _ + & release_type & "^^^" _ + & edition_type & "^^^" _ + & "office_2007" & "^^^" + entry form_input,comment,objTextFile,oAdd,oComment + strOffXPRUKey = "" + release_type = "" + edition_type = "" + form_input = "" + end if +Next + +'''''''''''''''''''''''''''''''' ' MS CD Keys for Office 2003 ' '''''''''''''''''''''''''''''''' strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Registration" @@ -3208,7 +3442,54 @@ +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 = "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_2003(subkey) vers = mid(subkey,4,2) if vers = "11" then vers_name = "Microsoft Office Professional Enterprise Edition 2003" end if @@ -3578,4 +3859,40 @@ 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: GetDomainComputers +' Description: Returns a listing of NT Computer Accounts for a given domain +' Parameters: ByVal strDomain - Name of an NT Domain to retrieve the +' list of Computer from. +' Returns: Variant array of NT Computer names for the specified domain. +'------------------------------------------------------------------------------- +Function GetDomainComputers(ByVal local_domain) + Dim objIADsContainer ' ActiveDs.IADsDomain + Dim objIADsComputer ' ActiveDs.IADsComputer + Dim vReturn ' Variant + + ' connect to the computer. + Set objIADsContainer = GetObject(local_domain) + + ' set the filter to retrieve only objects of class Computer + objIADsContainer.Filter = Array("Computer") + + ReDim vReturn(0) + For Each objIADsComputer In objIADsContainer + If Trim(vReturn(0)) <> "" Then + ReDim Preserve vReturn(UBound(vReturn) + 1) + End If + vReturn(UBound(vReturn)) = objIADsComputer.Name + Next + + GetDomainComputers = vReturn + Set objIADsComputer = Nothing + Set objIADsContainer = Nothing +End Function [/code]
audit.config diff
[code] Index: //apache/c$/xampp/htdocs/openaudit/scripts/audit.config =================================================================== --- //apache/c$/xampp/htdocs/openaudit/scripts/audit.config (revision 858) +++ //apache/c$/xampp/htdocs/openaudit/scripts/audit.config (working copy) @@ -1,23 +1,32 @@ -audit_location = "l" -verbose = "y" +audit_location = "r" +verbose = "y" +audit_host= "http://xxxx.xxxxxxx.com" online = "yesxml" -strComputer = "." +strComputer = "" ie_visible = "n" ie_auto_submit = "y" -ie_submit_verbose = "y" -ie_form_page = "http://localhost/openaudit/admin_pc_add_1.php" -non_ie_page = "http://localhost/openaudit/admin_pc_add_2.php" -input_file = "" -email_to = "" -email_from = "" -email_server = "" -audit_local_domain = "n" -local_domain = "LDAP://" +ie_submit_verbose = "n" +ie_form_page = audit_host + "/admin_pc_add_1.php" +non_ie_page = audit_host + "/admin_pc_add_2.php" +input_file = "" +email_to = "" +email_from = "" +'email_sender = "Open-AudIT" +email_server = "" ' IP address or FQDN +email_port = "25" ' The SMTP port +email_auth = "1" ' 0 = Anonymous, 1 = Clear-text Authentication, 2 = NTLM +email_user_id = "" ' A valid Email account in user@domain format +email_user_pwd = "" ' The SMTP email password +email_use_ssl = "false" ' True/False +email_timeout = "60" ' In seconds +domain_type = "nt" +audit_local_domain = "y" +local_domain = "WinNT://DOMAINNAME" hfnet = "n" Count = 0 -number_of_audits = 20 +number_of_audits = 10 script_name = "audit.vbs" monitor_detect = "y" printer_detect = "y" software_audit = "y" -uuid_type = "mac" +uuid_type = "uuid" [/code]
thanks
Jason
_________________ OA Deployment: Windows 2003 with XAMPP install 80 Windows Servers 250 Windows workstations (mixed XP and 2000) 5 MACs Multiple printers, switches, routers, firewalls, and other servers (ESX, AIX etc.)
|