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

Open-AudIT

What's on your network?
It is currently Fri Mar 29, 2024 4:15 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Improvement on audit.vbs
PostPosted: Tue Oct 21, 2008 8:00 pm 
Offline
Newbie

Joined: Wed Aug 29, 2007 5:24 pm
Posts: 6
I'd like to discuss my idea to make OpenAudit more customizable.

Actually we have one, large, script named audit.vbs, which contains all the audit code, merged with general functions and so on.
What about splitting this large file into several files, each one targeted to a specific task, stored in a dedicated folder like "\audits"?

In fact audit.vbs is already "splitted" through comments (see the sample SCSI section below):
[code]''''''''''''''''''
' SCSI Devices '
''''''''''''''''''
comment = "SCSI Devices"
Echo(comment)
On Error Resume Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_SCSIControllerDevice",,48)
For Each objItem in colItems
...
Next[/code]
All of this code could stay in a separate file, ie: XXX_scsi.vbs, where XXX is a number used to sort tasks (the *NIX way :) ).

This way audit.vbs will contain only the general code and a new function to include *.vbs files contained in the \audits folder, sorted by name. See this sample code to include a vbs file, taken from [url=http://www.source-code.biz/snippets/vbscript/5.htm]here[/url]:
[code]' Test program for the IncludeFile and ReadConfigFile functions.
' Author: Christian d'Heureuse (www.source-code.biz)

Option Explicit

Dim fso: set fso = CreateObject("Scripting.FileSystemObject")

' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified relative to the
' directory of the main script file.
Private Sub IncludeFile (ByVal RelativeFileName)
Dim ScriptDir: ScriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
Dim FileName: FileName = fso.BuildPath(ScriptDir,RelativeFileName)
IncludeFileAbs FileName
End Sub

' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified absolute (or
' relative to the current directory).
Private Sub IncludeFileAbs (ByVal FileName)
Const ForReading = 1
Dim f: set f = fso.OpenTextFile(FileName,ForReading)
Dim s: s = f.ReadAll()
ExecuteGlobal s
End Sub[/code]

PROs:
- Users can create their own tests, putting them in \audits folder with a proper name; subsequent SVN updates will not touch their own code
- Users can disable some tests by renaming the corresponding file or, better, by adding their names in a config file variable
- When debugging a problem on, say, the printer audit, we'll focus on audits\printer.vbs file only; bug fixes will affect only this file (SVN will be happy).

Let me know your opinions about this...

_________________
Claudio Nicora
http://coolsoft.altervista.org


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 21, 2008 9:48 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
It would make launching audit.vbs from the browser rather tricky!

Might we not be better breaking the file down in to separate functions, but keep it as one script.

Thus the script becomes far easier on the eye, but stays as one easily digestible, browser post-able, remotely run-able whole.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 21, 2008 10:46 pm 
Offline
Newbie

Joined: Wed Aug 29, 2007 5:24 pm
Posts: 6
Well, honestly I didn't think about running it in a browser.
I always run it through the console, remotely.

Anyway the whole script is becoming larger and keep an eye on is so difficult.

_________________
Claudio Nicora
http://coolsoft.altervista.org


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 11, 2008 7:50 am 
Offline
Newbie

Joined: Tue Nov 11, 2008 7:29 am
Posts: 1
I am in favor of modularizing audit.vbs. Launching via browser is our primary means of deployment since most of our machines are not on a domain. I don't think the browser will be a problem, however, since you could just have the php assemble the scripts into a single file for download.

We need to add support for collecting certain local security policy settings and it would be much easier if there was a simple way to write an addon. As it is right now, we would have to edit the monolithic script and it's not clear if/how the data would get transmitted to the server or displayed to the user.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 11, 2008 6:54 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
[quote="markhamc"]I am in favor of modularizing audit.vbs. Launching via browser is our primary means of deployment since most of our machines are not on a domain. I don't think the browser will be a problem, however, since you could just have the php assemble the scripts into a single file for download.


I like the idea of having PHP assemble the script, in fact that opens a whole bunch of possibilities, the basic audit.vbs could be a simple loader for the remainder of the script, which would be downloaded from the web host, and pre-configured by the web host. The disadvantage would be the inability to take the script off site, to do remote audits.

[quote="markhamc"]We need to add support for collecting certain local security policy settings and it would be much easier if there was a simple way to write an addon. As it is right now, we would have to edit the monolithic script and it's not clear if/how the data would get transmitted to the server or displayed to the user.

You are absolutely correct, modularising the script would make life easier if we wish to add additional functionality. What does everyone else think?

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 11, 2008 7:46 pm 
Offline
Newbie

Joined: Wed Aug 29, 2007 5:24 pm
Posts: 6
[quote="A_Hull"]The disadvantage would be the inability to take the script off site, to do remote audits.

The php could offer a download link; the downloaded file could be the complete/assembled audit.vbs script.

Anyway don't forget/exclude who, like me, is running the .vbs script through command line.

_________________
Claudio Nicora
http://coolsoft.altervista.org


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 11, 2008 11:29 pm 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
[quote="nicorac"]...Anyway don't forget/exclude who, like me, is running the .vbs script through command line.


I agree, we need to be careful not to break anything while making this work.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 12, 2008 12:46 am 
Offline
Helper

Joined: Fri Nov 16, 2007 1:32 am
Posts: 73
Location: Dallas,Texas
I like this idea...

You could have a audit.vbs that calls varios vbs based on configuration info.


That way you could schedule a low cumbersome audit durning the day and a intensive one at night, creating less impact.

_________________
1400 Servers Audited (1 hour interval) Applied via a local scheduler, deployed via GPO.
Running OA on IIS6 Web Server
90% Windows 2k3 Server (std,ent)
5% Windows XP
5% Windows 2000


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 12, 2008 5:43 am 
We audit different active directory OUs on each day, we have done this by having a different scripts directory for each OU and editing the audit .config in it. Upgrading needs each folder recreating and the respective files and audit config copying in. It would make life a lot easier if audit.vbs could be passed the config file as a parameter, eg "audit.vbs marketing.config". What do other people think, or have I missed an easier way to achieve what I want to do.

Server Info: Windows XP running XAMPP

Auditing: 4400 machines, mainly windows XP
W2K3: Active Directory


Top
  
Reply with quote  
PostPosted: Wed Nov 12, 2008 7:08 am 
Offline
Contributor

Joined: Fri Jul 28, 2006 6:30 am
Posts: 157
Location: London
[quote="markhamc"]I am in favor of modularizing audit.vbs. Launching via browser is our primary means of deployment since most of our machines are not on a domain. I don't think the browser will be a problem, however, since you could just have the php assemble the scripts into a single file for download.

We need to add support for collecting certain local security policy settings and it would be much easier if there was a simple way to write an addon. As it is right now, we would have to edit the monolithic script and it's not clear if/how the data would get transmitted to the server or displayed to the user.


I've banged on about making the audit script modular for ages ([url]http://www.open-audit.org/phpBB3/viewtopic.php?f=8&t=2740&hilit=[/url]). The reasons I've never got round to it myself are:

- It's a big task :!:
- Its monolithic nature makes me fearful of making a change that screws up the whole script
- I haven't yet got round to understanding the format of the data submitted, or how that data is processed on the server

However, here's a few of the ideas that I was going to pursue:
- I'd prefer that the script be written in javascript (no real reason - just that vbscript in an open-source project just doesn't feel right to me)
- I'd like to see the script as a generic action script where the actions/scripts are defined in the DB and one of those actions just happens to be "audit" (why? well I've got another script that performs software/patch installs - I'd love to integrate this with OA as an "install" action)
- Use XML format to submit data rather than the current proprietary format
- Use separate functions for each of the main audit sections and have them return their data as an XML tree something like:[code]
<table name="table1">
<record>
<field name="field1">value</field>
<field name="field2">value</field>
... etc ..
</record>
<record>
<field name="field1">value</field>
<field name="field2">value</field>
... etc ..
</record>
<table>
[/code]
- Then combine the XML nodes returned from each of these functions to create the complete XML document for submission
- The submitted XML data should be pretty easy to parse using the standard DOM libraries
- Have error handling localized to each of the individual audit routines. If an error is non-critical the script can then continue albeit with missing data
- Implement basic event logging. Log when a system has been audited. Log errors generated by the script where possible.

Not sure how much of this is practical, but I thought I'd throw them out there for discussion.

_________________
Cheers, Nick.

[size=85]OA Server: Windows Server 2003 / Apache 2
Auditing: 1600 Workstations, 200 Servers
OS's: Windows XP / Windows 2000 / Windows 2003 Server / Windows Vista
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 12, 2008 8:20 am 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
Whatever the script is written, vbs or otherwise, it needs to talk to WMI, otherwise it wont work. I suspect this is not possible with javascript.
Perhaps the key reason for using vbscript is that there are lots of WMI/VBscript resources out there.
Modularising the script is a good idea at every level, but you are right to suggest it is a big task, but mainly because it is a big script.

The output format is actually quite simple, and we have discussed it elsewhere in the forums, as I recall quite a lot has been said about modularisation, but we have always shied away from getting in because the task seemed a little daunting.

What might be worth finding out is will these efforts be wasted if OA v2 arrives, or will our coding be portable to the new version.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 12, 2008 8:09 pm 
Offline
Contributor

Joined: Fri Jul 28, 2006 6:30 am
Posts: 157
Location: London
[quote="A_Hull"]Whatever the script is written, vbs or otherwise, it needs to talk to WMI, otherwise it wont work. I suspect this is not possible with javascript.


WMI is exposed to javascript (on Windows) as a COM library just like it is in VBScript so there is no problem using it.

[quote="A_Hull"]What might be worth finding out is will these efforts be wasted if OA v2 arrives, or will our coding be portable to the new version.

I also have this concern generally. Mark appears to be developing OAv2 in isolation, which is his prerogative of course, but I am reticent to committing a lot of time to OAv1 development if it is re-inventing what is already in v2 or will not easily be migrated to v2.

_________________
Cheers, Nick.

[size=85]OA Server: Windows Server 2003 / Apache 2
Auditing: 1600 Workstations, 200 Servers
OS's: Windows XP / Windows 2000 / Windows 2003 Server / Windows Vista
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 13, 2008 12:17 am 
Offline
Helper

Joined: Fri Nov 16, 2007 1:32 am
Posts: 73
Location: Dallas,Texas
Or better yet why not write a service in C# or VB that can listen for requests from the OA server and also includes its own scheduler to run certain modules of the audit process.

_________________
1400 Servers Audited (1 hour interval) Applied via a local scheduler, deployed via GPO.
Running OA on IIS6 Web Server
90% Windows 2k3 Server (std,ent)
5% Windows XP
5% Windows 2000


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 13, 2008 1:11 am 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
[quote="jhurd8025"]Or better yet why not write a service in C# or VB that can listen for requests from the OA server and also includes its own scheduler to run certain modules of the audit process.


One of the original design goals was to be able to audit Windows PCs without having to install any client software on them. Setting up a service is a pain, and means you often have to visit remote machines, and re-boot them. Audit.vbs may not be pretty, but it generally manages a zero install audit, not just of individual pcs, but entire domains. Any replacement would have to be as flexible, and configurable. BTW we already have the service on the PCs, its called WMI.

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 13, 2008 8:35 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1964
Location: Brisbane, Australia
OAv2 outputs XML.
It's no more modular than the current script.
I'll attach the current OAv2 script.
If anyone has some idea's on how to modularize it, please speak up - but hacking the script below would be very much appreciated.
I do like the idea of having individual modules and having a PHP script combine them....
Hack away !!!

NOTE #1 - the scripts are still rough, and have no abilities to Domain Audit, etc, etc. They don't retrieve any near as much as the existing script. They simply output a text file, with the PC name. Inside should be XML. At the moment, I am just copying and pasting this into the web interface.
NOTE #2 - the XML attributes closely (not exactly, but closely) match the database field names.
NOTE #3 - ignore the SQL Database retrieval stuff at the end. I am testing how to retrieve the installed DBs. It works with SQL2005, but I don't know about other stuff. If someone wants to get it working for SQL7, 2000, 2005 & 2008, be my guest.

NOTE #4 - by the way, OAv2 is progressing OK. I am still using CodeIgniter, and quite like it. I think this says a lot, coming from a procedural programmer.... I may have an alpha soon. I'll start a thread when I'm ready, and people can put up their hands to take a look. It will be basic, but the foundations are looking real good, from a "going forward" point of view. It is much prettier than Open-AudIT, and has a quite dynamic interface (sorting tables by column, dynamic section display, better stylesheets, nice icons, etc, etc). I'd put up some pages, but combining all the JavaScript and images etc, for a static html page is a pain (maybe I'm just lazy)...

Without further adieu, here it is....

[code]'''''''''''''''''''''''''''''''''''

' Open Audit '

' Software and Hardware Inventory '

' (c) Open-Audit.org 2003-2008 '

' Licensed under the GPL '

'''''''''''''''''''''''''''''''''''


strComputer = "."
debugging = "yes"
detectsql = "no"


''''''''''''''''''''''''''''''''''''''''

' 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





Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objWMIService2 = GetObject("winmgmts:\\" & strComputer & "\root\WMI")

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")



if debugging = "yes" then

wscript.echo "starting audit"

end if



start_time = Timer

dim dt : dt = Now()

system_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)



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_memory = (objItem.TotalPhysicalMemory / 1024)

system_pc_num_processor = objItem.NumberOfProcessors

system_model = objItem.Model

windows_domain_role = objItem.DomainRole

windows_part_of_domain = objItem.PartOfDomain

Next



Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True' ",,48)

For Each objItem in colItems

system_mac_address = objItem.MACAddress

For i = LBound(objItem.IPAddress) to UBound(objItem.IPAddress)

system_ip_address = objItem.IPAddress(i)

exit for

Next

Next



Set wshNetwork = WScript.CreateObject( "WScript.Network" )

windows_user_name = wshNetwork.userName



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_OperatingSystem",,48)

For Each objItem in colItems

system_os_full_name = objItem.Caption

system_os_short_name = os_short_name(system_os_full_name)

system_os_version = objItem.Version

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_build_number = objItem.BuildNumber

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_service_pack = objItem.ServicePackMajorVersion

windows_install_directory_split = split(objItem.Name, "|")

windows_install_directory = windows_install_directory_split(1)

Next





Set colItems = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure",,48)

For Each objItem in colItems

system_form_factor = form_factor(Join(objItem.ChassisTypes, ","))

Next





result = "<?xml version=""1.0"" encoding=""ISO-8859-1""?>" & vbcrlf

result = result & "<system>" & vbcrlf

result = result & " <sys>" & vbcrlf

result = result & " <system_timestamp>" & system_timestamp & "</system_timestamp>" & vbcrlf

result = result & " <system_uuid>" & system_uuid & "</system_uuid>" & vbcrlf

result = result & " <system_mac_address>" & system_mac_address & "</system_mac_address>" & vbcrlf

result = result & " <system_ip_address>" & system_ip_address & "</system_ip_address>" & vbcrlf

result = result & " <system_hostname>" & system_hostname & "</system_hostname>" & vbcrlf

result = result & " <system_domain>" & system_domain & "</system_domain>" & vbcrlf

result = result & " <system_description>" & system_description & "</system_description>" & vbcrlf

result = result & " <system_type>system</system_type>" & vbcrlf

result = result & " <system_os>windows</system_os>" & vbcrlf

result = result & " <system_os_short_name>" & system_os_short_name & "</system_os_short_name>" & vbcrlf

result = result & " <system_os_full_name>" & system_os_full_name & "</system_os_full_name>" & vbcrlf

result = result & " <system_os_version>" & system_os_version & "</system_os_version>" & vbcrlf

result = result & " <system_serial>" & system_serial & "</system_serial>" & vbcrlf

result = result & " <system_model>" & system_model & "</system_model>" & vbcrlf

result = result & " <system_manufacturer>" & system_manufacturer & "</system_manufacturer>" & vbcrlf

result = result & " <system_form_factor>" & system_form_factor & "</system_form_factor>" & vbcrlf

result = result & " <system_pc_memory>" & system_pc_memory & "</system_pc_memory>" & vbcrlf

result = result & " <system_pc_num_processor>" & system_pc_num_processor & "</system_pc_num_processor>" & vbcrlf

result = result & " <system_pc_date_os_installation>" & system_pc_date_os_installation & "</system_pc_date_os_installation>" & vbcrlf

result = result & " </sys>" & vbcrlf





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



' 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)

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



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



if debugging = "yes" then

wscript.echo "windows info"

end if


result = result & " <windows>" & vbcrlf

result = result & " <windows_build_number>" & windows_build_number & "</windows_build_number>" & vbcrlf

result = result & " <windows_user_name>" & windows_user_name & "</windows_user_name>" & vbcrlf

result = result & " <windows_client_site_name>" & windows_client_site_name & "</windows_client_site_name>" & vbcrlf

result = result & " <windows_domain_controller_address>" & windows_domain_controller_address & "</windows_domain_controller_address>" & vbcrlf

result = result & " <windows_domain_controller_name>" & windows_domain_controller_name & "</windows_domain_controller_name>" & vbcrlf

result = result & " <windows_domain_role>" & windows_domain_role & "</windows_domain_role>" & vbcrlf

result = result & " <windows_part_of_domain>" & windows_part_of_domain & "</windows_part_of_domain>" & vbcrlf

result = result & " <windows_id_number>" & windows_id_number & "</windows_id_number>" & vbcrlf

result = result & " <windows_time_caption>" & windows_time_caption & "</windows_time_caption>" & vbcrlf

result = result & " <windows_time_daylight>" & windows_time_daylight & "</windows_time_daylight>" & vbcrlf

result = result & " <windows_boot_device>" & windows_boot_device & "</windows_boot_device>" & vbcrlf

result = result & " <windows_country_code>" & windows_country_code & "</windows_country_code>" & vbcrlf

result = result & " <windows_organisation>" & windows_organisation & "</windows_organisation>" & vbcrlf

result = result & " <windows_language>" & windows_language & "</windows_language>" & vbcrlf

result = result & " <windows_registered_user>" & windows_registered_user & "</windows_registered_user>" & vbcrlf

result = result & " <windows_service_pack>" & windows_service_pack & "</windows_service_pack>" & vbcrlf

result = result & " <windows_version>" & system_os_version & "</windows_version>" & vbcrlf

result = result & " <windows_install_directory>" & windows_install_directory & "</windows_install_directory>" & vbcrlf

result = result & " </windows>" & vbcrlf



if debugging = "yes" then

wscript.echo "bios info"

end if

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS",,48)

For Each objItem in colItems

bios_description = objItem.Description

bios_manufacturer = objItem.Manufacturer

bios_serial = objItem.SerialNumber

bios_smversion = objItem.SMBIOSBIOSVersion

bios_version = objItem.Version

Next

result = result & " <bios>" & vbcrlf

result = result & " <bios_description>" & bios_description & "</bios_description>" & vbcrlf

result = result & " <bios_manufacturer>" & bios_manufacturer & "</bios_manufacturer>" & vbcrlf

result = result & " <bios_serial>" & bios_serial & "</bios_serial>" & vbcrlf

result = result & " <bios_smversion>" & bios_smversion & "</bios_smversion>" & vbcrlf

result = result & " <bios_version>" & bios_version & "</bios_version>" & vbcrlf

result = result & " </bios>" & vbcrlf









if debugging = "yes" then

wscript.echo "disk info"

end if

result = result & " <hard_disks>" & vbcrlf

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48)

For Each objItem in colItems

hard_drive_caption = objItem.Caption

hard_drive_index = objItem.Index

hard_drive_interface_type = objItem.InterfaceType

hard_drive_manufacturer = objItem.manufacturer

hard_drive_model = objItem.Model

hard_drive_serial = ""

hard_drive_size = int(objItem.size / 1024 / 1024)

hard_drive_device_id = objItem.deviceid

hard_drive_partitions = objItem.Partitions

result = result & " <hard_disk>" & vbcrlf

result = result & " <hard_drive_caption>" & hard_drive_caption & "</hard_drive_caption>" & vbcrlf

result = result & " <hard_drive_index>" & hard_drive_index & "</hard_drive_index>" & vbcrlf

result = result & " <hard_drive_interface_type>" & hard_drive_interface_type & "</hard_drive_interface_type>" & vbcrlf

result = result & " <hard_drive_manufacturer>" & hard_drive_manufacturer & "</hard_drive_manufacturer>" & vbcrlf

result = result & " <hard_drive_model>" & hard_drive_model & "</hard_drive_model>" & vbcrlf

result = result & " <hard_drive_serial>" & hard_drive_serial & "</hard_drive_serial>" & vbcrlf

result = result & " <hard_drive_size>" & hard_drive_size & "</hard_drive_size>" & vbcrlf

result = result & " <hard_drive_device_id>" & hard_drive_device_id & "</hard_drive_device_id>" & vbcrlf

result = result & " <hard_drive_partitions>" & hard_drive_partitions & "</hard_drive_partitions>" & vbcrlf

result = result & " </hard_disk>" & vbcrlf

Next

result = result & " </hard_disks>" & vbcrlf













if debugging = "yes" then

wscript.echo "partition info"

end if

result = result & " <partitions>" & vbcrlf

' 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

on error resume next

partition_caption = objItem.Caption

partition_mount_point = 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_used_space = int(partition_size - partition_free_space)

partition_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

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

splitpath = split(objLogicalDiskToPartition.path_.relpath,"=")

LogicalDisk_DeviceID = ""

LogicalDisk_DeviceID = splitpath(2)

LogicalDisk_DeviceID = replace(LogicalDisk_DeviceID,"\","")

LogicalDisk_DeviceID = replace(LogicalDisk_DeviceID,"""","")

Else

Err.Clear

End If

On Error Resume Next

' END Associate with Device_ID in Win32_DiskPartition using objLogicalDiskToPartition

Next

result = result & " <partition>" & vbcrlf

result = result & " <hard_drive_index>" & partition_disk_index & "</hard_drive_index>" & vbcrlf

result = result & " <partition_mount_point>" & partition_mount_point & "</partition_mount_point>" & vbcrlf

result = result & " <partition_name>" & partition_name & "</partition_name>" & vbcrlf

result = result & " <partition_size>" & partition_size & "</partition_size>" & vbcrlf

result = result & " <partition_free_space>" & partition_free_space & "</partition_free_space>" & vbcrlf

result = result & " <partition_used_space>" & partition_used_space & "</partition_used_space>" & vbcrlf

result = result & " <partition_format>" & partition_file_system & "</partition_format>" & vbcrlf

result = result & " <partition_caption>" & partition_caption & "</partition_caption>" & vbcrlf

result = result & " <partition_device_id>" & partition_device_id & "</partition_device_id>" & vbcrlf

result = result & " <partition_disk_index>" & partition_index & "</partition_disk_index>" & vbcrlf

result = result & " </partition>" & vbcrlf

Next

result = result & " </partitions>" & vbcrlf





if debugging = "yes" then

wscript.echo "network card info"

end if

result = result & " <network_cards>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True' ",,48)

For Each objItem in colItems

net_index = objItem.Index

net_description = objItem.Description

net_dhcp_enabled = objItem.DHCPEnabled

net_dhcp_server = objItem.DHCPServer

net_dhcp_lease_obtained = WMIDateStringToDate(objItem.DHCPLeaseObtained)

net_dhcp_lease_expires = WMIDateStringToDate(objItem.DHCPLeaseExpires)

net_dns_server = Join(objItem.DNSServerSearchOrder, ",")

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)

For Each objItem2 in colItems2

net_adapter_type = objItem2.AdapterType

net_mac_address = objItem2.MACAddress

net_connection_id = objItem2.NetConnectionID

net_manufacturer = objItem2.Manufacturer

net_model = objItem2.ProductName

net_connection_status = WMINetConnectorStatus(objItem2.NetConnectionStatus)

if objItem2.NetConnectionStatus = "2" 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

result = result & " <network_card>" & vbcrlf

result = result & " <net_mac_address>" & net_mac_address & "</net_mac_address>" & vbcrlf

result = result & " <net_manufacturer>" & net_manufacturer & "</net_manufacturer>" & vbcrlf

result = result & " <net_model>" & net_model & "</net_model>" & vbcrlf

result = result & " <net_description>" & net_description & "</net_description>" & vbcrlf

result = result & " <net_ip_enabled>" & net_ip_enabled & "</net_ip_enabled>" & vbcrlf

result = result & " <net_index>" & net_index & "</net_index>" & vbcrlf

result = result & " <net_dhcp_enabled>" & net_dhcp_enabled & "</net_dhcp_enabled>" & vbcrlf

result = result & " <net_dhcp_server>" & net_dhcp_server & "</net_dhcp_server>" & vbcrlf

result = result & " <net_dhcp_lease_obtained>" & net_dhcp_lease_obtained & "</net_dhcp_lease_obtained>" & vbcrlf

result = result & " <net_dhcp_lease_expires>" & net_dhcp_lease_expires & "</net_dhcp_lease_expires>" & vbcrlf

result = result & " <net_dns_host_name>" & net_dns_host_name & "</net_dns_host_name>" & vbcrlf

result = result & " <net_dns_server>" & net_dns_server & "</net_dns_server>" & vbcrlf

result = result & " <net_dns_domain>" & net_dns_domain & "</net_dns_domain>" & vbcrlf

' result = result & " <net_dns_domain_suffix>" & net_dns_domain_suffix & "</net_dns_domain_suffix>" & vbcrlf

result = result & " <net_dns_domain_reg_enabled>" & net_dns_domain_reg_enabled & "</net_dns_domain_reg_enabled>" & vbcrlf

result = result & " <net_adapter_type>" & net_adapter_type & "</net_adapter_type>" & vbcrlf

result = result & " <net_wins_primary>" & net_wins_primary & "</net_wins_primary>" & vbcrlf

result = result & " <net_wins_secondary>" & net_wins_secondary & "</net_wins_secondary>" & vbcrlf

result = result & " <net_wins_lmhosts_enabled>" & net_wins_lmhosts_enabled & "</net_wins_lmhosts_enabled>" & vbcrlf

' result = result & " <>" & & "</>" & vbcrlf

' result = result & " <>" & & "</>" & vbcrlf

' result = result & " <net_>" & & "</net_>" & vbcrlf

' result = result & " <net_>" & & "</net_>" & vbcrlf

' result = result & " <net_>" & & "</net_>" & vbcrlf

' result = result & " <net_>" & & "</net_>" & vbcrlf

result = result & " <net_connection_id>" & net_connection_id & "</net_connection_id>" & vbcrlf

result = result & " <net_connection_status>" & net_connection_status & "</net_connection_status>" & vbcrlf

result = result & " <net_speed>" & net_speed & "</net_speed>" & vbcrlf

result = result & " </network_card>" & vbcrlf

Next

Next

result = result & " </network_cards>" & vbcrlf



if debugging = "yes" then

wscript.echo "network address info"

end if

result = result & " <addresses>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration " _

& "WHERE IPEnabled = 'True' ",,48)

For Each objItem in colItems

net_mac_address = objItem.MACAddress

For i = LBound(objItem.IPAddress) to UBound(objItem.IPAddress)

ip_address = objItem.IPAddress(i)

ip_subnet = objItem.IPSubnet(i)

result = result & " <ip_address>" & vbcrlf

result = result & " <net_mac_address>" & net_mac_address & "</net_mac_address>" & vbcrlf

result = result & " <ip_address>" & ip_address & "</ip_address>" & vbcrlf

result = result & " <ip_address_v6></ip_address_v6>" & vbcrlf

result = result & " <ip_subnet>" & ip_subnet & "</ip_subnet>" & vbcrlf

result = result & " </ip_address>" & vbcrlf

Next

Next

result = result & " </addresses>" & vbcrlf



if debugging = "yes" then

wscript.echo "processor info"

end if

result = result & " <processors>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)

For Each objItem In colItems

processor_description = objItem.Name

processor_speed = objItem.MaxClockSpeed

processor_manufacturer = objItem.Manufacturer

processor_power_management_supported = objItem.PowerManagementSupported

Next

result = result & " <processor>" & vbcrlf

result = result & " <processor_cores>" & system_pc_num_processor & "</processor_cores>" & vbcrlf

result = result & " <processor_description>" & processor_description & "</processor_description>" & vbcrlf

result = result & " <processor_speed>" & processor_speed & "</processor_speed>" & vbcrlf

result = result & " <processor_manufacturer>" & processor_manufacturer & "</processor_manufacturer>" & vbcrlf

result = result & " <processor_power_management_supported>" & processor_power_management_supported & "</processor_power_management_supported>" & vbcrlf

result = result & " </processor>" & vbcrlf

result = result & " </processors>" & vbcrlf





if debugging = "yes" then

wscript.echo "optical info"

end if

result = result & " <optical_drives>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive",,48)

For Each objItem in colItems

result = result & " <optical_drive>" & vbcrlf

result = result & " <optical_drive_caption>" & objItem.Caption & "</optical_drive_caption>" & vbcrlf

result = result & " <optical_drive_model>" & objItem.Caption & "</optical_drive_model>" & vbcrlf

result = result & " <optical_drive_device_id>" & objItem.DeviceID & "</optical_drive_device_id>" & vbcrlf

result = result & " <optical_drive_mount_point>" & objItem.Drive & "</optical_drive_mount_point>" & vbcrlf

result = result & " </optical_drive>" & vbcrlf

Next

result = result & " </optical_drives>" & vbcrlf







if debugging = "yes" then

wscript.echo "video info"

end if

result = result & " <video_cards>" & vbcrlf

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

result = result & " <video_card>" & vbcrlf

result = result & " <video_description>" & objItem.Name & "</video_description>" & vbcrlf

result = result & " <video_manufacturer></video_manufacturer>" & vbcrlf

result = result & " <video_memory>" & objItem.AdapterRAM & "</video_memory>" & vbcrlf

result = result & " </video_card>" & vbcrlf



end if

Next

result = result & " </video_cards>" & vbcrlf



if debugging = "yes" then

wscript.echo "sound info"

end if

result = result & " <sound_cards>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_SoundDevice",,48)

For Each objItem in colItems

result = result & " <sound_card>" & vbcrlf

result = result & " <sound_name>" & objItem.Name & "</sound_name>" & vbcrlf

result = result & " <sound_manufacturer>" & objItem.Manufacturer & "</sound_manufacturer>" & vbcrlf

result = result & " <sound_device_id>" & objItem.DeviceID & "</sound_device_id>" & vbcrlf

result = result & " </sound_card>" & vbcrlf

Next

result = result & " </sound_cards>" & vbcrlf







result = result & " <software>" & vbcrlf



if debugging = "yes" then

wscript.echo "BHO info"

end if

' Browser Helper Objects

if (system_os_full_name <> "Microsoft Windows 95" AND system_os_full_name <> "Microsoft Windows 98") 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 & " <package>" & vbcrlf

result = result & " <software_name>" & strIESetting.ProgramFile & "</software_name>" & vbcrlf

result = result & " <software_version></software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date></software_install_date>" & vbcrlf

result = result & " <software_publisher></software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>" & strIESetting.CodeBase & "</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment>browser addon</software_comment>" & vbcrlf

result = result & " <software_code_base>" & strIESetting.CodeBase & "</software_code_base>" & vbcrlf

result = result & " <software_status>" & strIESetting.Status & "</software_status>" & vbcrlf

result = result & " </package>" & vbcrlf

Next

end if





if debugging = "yes" then

wscript.echo "Codec info"

end if

' Installed Codecs

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CodecFile", , 48)

For Each objItem In colItems

if objItem.Manufacturer <> "Microsoft Corporation" then

form_input = "software^^^Codec - " & clean(objItem.Group) & " - " & clean(objItem.Filename) & "^^^" _

& clean(objItem.Version) & "^^^" _

& clean(objItem.Caption) & "^^^" _

& " ^^^" _

& clean(objItem.InstallDate) & "^^^" _

& clean(objItem.Manufacturer) & "^^^" _

& " ^^^" _

& " ^^^" _

& " ^^^" _

& clean(objItem.Description) & "^^^"

result = result & " <package>" & vbcrlf

result = result & " <software_name>" & objItem.Group & " - " & objItem.Filename & "</software_name>" & vbcrlf

result = result & " <software_version>" & objItem.Version & "</software_version>" & vbcrlf

result = result & " <software_location>" & objItem.Caption & "</software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & objItem.InstallDate & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>" & objItem.Manufacturer & "</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url></software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment>codec</software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf

end if

Next



if debugging = "yes" then

wscript.echo "MDAC info"

end if

' MDAC/WDAC

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 & " <package>" & vbcrlf

result = result & " <software_name>" & display_name & "</software_name>" & vbcrlf

result = result & " <software_version>" & dac_version & "</software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & system_pc_date_os_installation & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>Microsoft Corporation</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>http://msdn2.microsoft.com/en-us/data/default.aspx</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment></software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf



if debugging = "yes" then

wscript.echo "DirectX info"

end if

' DirectX

strKeyPath = "SOFTWARE\Microsoft\DirectX"

strValueName = "Version"

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dx_version

display_name = "DirectX"

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

result = result & " <package>" & vbcrlf

result = result & " <software_name>" & dx_name & "</software_name>" & vbcrlf

result = result & " <software_version>" & dx_version & "</software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & system_pc_date_os_installation & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>Microsoft Corporation</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>http://www.microsoft.com/windows/directx/</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment></software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf



if debugging = "yes" then

wscript.echo "Windows Media Player info"

end if

' Windows Media Player

strKeyPath = "SOFTWARE\Microsoft\MediaPlayer\PlayerUpgrade"

strValueName = "PlayerVersion"

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,wmp_version

result = result & " <package>" & vbcrlf

result = result & " <software_name>Windows Media Player</software_name>" & vbcrlf

result = result & " <software_version>" & wmp_version & "</software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & system_pc_date_os_installation & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>Microsoft Corporation</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>http://www.microsoft.com/windows/windowsmedia/default.aspx</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment></software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf



if debugging = "yes" then

wscript.echo "Internet Explorer info"

end if

' Internet Explorer

strKeyPath = "SOFTWARE\Microsoft\Internet Explorer"

strValueName = "Version"

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,ie_version

result = result & " <package>" & vbcrlf

result = result & " <software_name>Internet Explorer</software_name>" & vbcrlf

result = result & " <software_version>" & ie_version & "</software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & system_pc_date_os_installation & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>Microsoft Corporation</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>http://www.microsoft.com/windows/ie/community/default.mspx</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment></software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf



if debugging = "yes" then

wscript.echo "Outlook Express info"

end if

' Outlook Express

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 & " <package>" & vbcrlf

result = result & " <software_name>Outlook Express</software_name>" & vbcrlf

result = result & " <software_version>" & objFile.Version & "</software_version>" & vbcrlf

result = result & " <software_location></software_location>" & vbcrlf

result = result & " <software_uninstall></software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & system_pc_date_os_installation & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>Microsoft Corporation</software_publisher>" & vbcrlf

result = result & " <software_install_source></software_install_source>" & vbcrlf

result = result & " <software_system_component></software_system_component>" & vbcrlf

result = result & " <software_url>http://support.microsoft.com/default.aspx?xmlid=fh;en-us;oex</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment></software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf

Next



if debugging = "yes" then

wscript.echo "Software info"

end if

' Installed Software

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



result = result & " <package>" & vbcrlf

result = result & " <software_name>" & package_name & "</software_name>" & vbcrlf

result = result & " <software_version>" & package_version & "</software_version>" & vbcrlf

result = result & " <software_location>" & package_location & "</software_location>" & vbcrlf

result = result & " <software_uninstall>" & package_uninstall & "</software_uninstall>" & vbcrlf

result = result & " <software_install_date>" & package_install_date & "</software_install_date>" & vbcrlf

result = result & " <software_publisher>" & package_publisher & "</software_publisher>" & vbcrlf

result = result & " <software_install_source>" & package_install_source & "</software_install_source>" & vbcrlf

result = result & " <software_system_component>" & package_system_component & "</software_system_component>" & vbcrlf

result = result & " <software_url>" & package_url & "</software_url>" & vbcrlf

result = result & " <software_email></software_email>" & vbcrlf

result = result & " <software_comment>" & package_comments & "</software_comment>" & vbcrlf

result = result & " <software_code_base></software_code_base>" & vbcrlf

result = result & " <software_status></software_status>" & vbcrlf

result = result & " </package>" & vbcrlf

end If

Next

result = result & " </software>" & vbcrlf







if debugging = "yes" then

wscript.echo "Services info"

end if

' Services

result = result & " <services>" & vbcrlf

Set colItems = objWMIService.ExecQuery("Select * from Win32_Service",,48)

For Each objItem in colItems

result = result & " <service>" & vbcrlf

result = result & " <service_description>" & objItem.Description & "</service_description>" & vbcrlf

result = result & " <service_display_name>" & objItem.DisplayName & "</service_display_name>" & vbcrlf

result = result & " <service_name>" & objItem.Name & "</service_name>" & vbcrlf

result = result & " <service_path_name>" & objItem.PathName & "</service_path_name>" & vbcrlf

result = result & " <service_started>" & objItem.Started & "</service_started>" & vbcrlf

result = result & " <service_start_mode>" & objItem.StartMode & "</service_start_mode>" & vbcrlf

result = result & " <service_state>" & objItem.State & "</service_state>" & vbcrlf

result = result & " </service>" & vbcrlf

' Searching for IIS services

Select Case objItem.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" sql_server = "True"

End Select

Next

result = result & " </services>" & vbcrlf

















if debugging = "yes" then

wscript.echo "SQL info"

end if



if detectsql = "yes" then

SQLDMOSecurity_Integrated = 1

SQLDMOSecurity_Mixed = 2

SQLDMOSecurity_Normal = 0

SQLDMOSecurity_Unknown = 9



Set objSQLServer = CreateObject("SQLDMO.SQLServer")

'objDMO.Connect "(local)", "sa", "password123"

objSQLServer.LoginSecure = True

objSQLServer.Connect strComputer



Select Case objSQLServer.ServerLoginMode(strComputer)

Case SQLDMOSecurity_Integrated

login = "Allow Windows Authentication only."

Case SQLDMOSecurity_Mixed

login = "Allow Windows Authentication or SQL Server Authentication."

Case SQLDMOSecurity_Normal

login = "Allow SQL Server Authentication only."

Case SQLDMOSecurity_Unknown

login = "Security type unknown."

End Select





result = result & " <database>" & vbcrlf

result = result & " <db_type>SQL Server</db_type>" & vbcrlf

result = result & " <db_version>" & objSQLServer.VersionMajor & "." & objSQLServer.VersionMinor & "</db_version>" & vbcrlf

'result = result & " <db_version_string>" & objSQLServer.VersionString & "<db_version_string>" & vbcrlf

result = result & " <db_port>1433</db_port>" & vbcrlf

result = result & " <db_login_type>" & login & "</db_login_type>" & vbcrlf

result = result & " </database>" & vbcrlf



Dim objCN, strConnection, strSQLQuery, objRS

Set objCN = CreateObject("ADODB.Connection")

strConnection = "Driver={SQL Server};Server=" & strComputer & ";Database=MASTER;Trusted_Connection=TRUE"

objCN.Open strConnection

strSQLQuery = "Select * from sys.sysdatabases order by dbid"

Set objRS = CreateObject("ADODB.Recordset")

Set objRS = objCN.Execute(strSQLQuery)



result = result & " <database_details>" & vbcrlf

Do Until objRS.EOF

filename = replace(objRS.Fields("filename"), "\", "\\")

Set colFiles = objWMIService.ExecQuery ("Select * from CIM_Datafile Where name = '" & filename & "'")

For Each objFile in colFiles

filesize = objFile.FileSize / 1024

Next

result = result & " <details>" & vbcrlf

result = result & " <details_name>" & objRS.Fields("name") & "</details_name>" & vbcrlf

result = result & " <details_internal_id>" & objRS.Fields("dbid") & "</details_internal_id>" & vbcrlf

result = result & " <details_current_size>" & filesize & "</details_current_size>" & vbcrlf

result = result & " <details_creation_date>" & objRS.Fields("crdate") & "</details_creation_date>" & vbcrlf

result = result & " <details_filename>" & objRS.Fields("filename") & "</details_filename>" & vbcrlf

result = result & " </details>" & vbcrlf

objRS.MoveNext

Loop

result = result & " </database_details>" & vbcrlf



strSQLQuery = "select d.dbid, d.name, p.login_time, p.hostname, p.program_name, p.nt_domain, p.nt_username, p.net_library, p.loginame from sys.sysprocesses p, sys.sysdatabases d where p.dbid = d.dbid AND p.login_time = (SELECT max(sys.sysprocesses.login_time) FROM sys.sysprocesses WHERE [dbid] = d.[dbid])"

Set objRS = objCN.Execute(strSQLQuery)

result = result & " <database_log>" & vbcrlf

Do Until objRS.EOF

result = result & " <log>" & vbcrlf

result = result & " <log_database_name>" & trim(objRS.Fields("name")) & "</log_database_name>" & vbcrlf

result = result & " <log_database_id>" & trim(objRS.Fields("dbid")) & "</log_database_id>" & vbcrlf

result = result & " <log_last_accessed_date>" & trim(objRS.Fields("login_time")) & "</log_last_accessed_date>" & vbcrlf

result = result & " <log_last_accessed_login_name>" & trim(objRS.Fields("loginame")) & "</log_last_accessed_login_name>" & vbcrlf

result = result & " <log_last_accessed_hostname>" & trim(objRS.Fields("hostname")) & "</log_last_accessed_hostname>" & vbcrlf

result = result & " <log_last_accessed_program>" & trim(objRS.Fields("program_name")) & "</log_last_accessed_program>" & vbcrlf

result = result & " <log_last_accessed_domain>" & trim(objRS.Fields("nt_domain")) & "</log_last_accessed_domain>" & vbcrlf

result = result & " <log_last_accessed_username>" & trim(objRS.Fields("nt_username")) & "</log_last_accessed_username>" & vbcrlf

result = result & " <log_last_accessed_protocol>" & trim(objRS.Fields("net_library")) & "</log_last_accessed_protocol>" & vbcrlf

result = result & " </log>" & vbcrlf

objRS.MoveNext

Loop

result = result & " </database_log>" & vbcrlf



objRS.Close

objCN.Close



end if





result = result & " <software_keys>" & vbcrlf

'''''''''''''''''''''''''''''''''''''''''''''''''

' MS CD Keys for Windows XP, 2000, 2003 and Vista '

'''''''''''''''''''''''''''''''''''''''''''''''''

IsOSXP = InStr(system_os_full_name, "Windows XP")

IsOS2K = InStr(system_os_full_name, "Windows 2000")

IsOS2K3 = InStr(system_os_full_name, "Server 2003")

IsOSVista = InStr(system_os_full_name, "Windows Vista")

IsOSXP2K2K3WV = CInt(IsOSXP + IsOS2K + IsOS2K3 + IsOSVista)



if (IsOSXP2K2K3WV > 0) then

path = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"

subKey = "DigitalProductId"

oReg.GetBinaryValue HKEY_LOCAL_MACHINE,path,subKey,key

strXPKey=GetKey(key)

if IsNull(strXPKey) then

' Do nothing

else

result = result & " <key>" & vbcrlf

result = result & " <key_name>" & system_os_full_name & "</key_name>" & vbcrlf

result = result & " <key_text>" & strXPKey & "</key_text>" & vbcrlf

result = result & " <key_release>" & windows_build_number & "</key_release>" & vbcrlf

result = result & " <key_edition>" & system_os_version & "</key_edition>" & vbcrlf

result = result & " </key>" & vbcrlf

strOffXPRUKey = ""

release_type = ""

edition_type = ""

form_input = ""

end if

end if



''''''''''''''''''''''''''''''''

' MS CD Keys for Office 2003 '

''''''''''''''''''''''''''''''''

strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Registration"

oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys

name_2003 = get_sku_2003(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

' Do nothing

else

strOffXPRUKey=GetKey(key)

result = result & " <key>" & vbcrlf

result = result & " <key_name>" & name_2003 & "</key_name>" & vbcrlf

result = result & " <key_text>" & strOffXPRUKey & "</key_text>" & vbcrlf

result = result & " <key_release>" & release_type & "</key_release>" & vbcrlf

result = result & " <key_edition>" & edition_type & "</key_edition>" & vbcrlf

result = result & " </key>" & vbcrlf

strOffXPRUKey = ""

release_type = ""

edition_type = ""

form_input = ""

end if

Next

result = result & " </software_keys>" & vbcrlf









if debugging = "yes" then

wscript.echo "Writing File"

end if

' Write the results to a file

Set objFSO = CreateObject("Scripting.FileSystemObject")

Const FOR_READING = 1

Const FOR_WRITING = 2

Const FOR_APPENDING = 8

result = result & "</system>"

'OutputFile = "c:\" & system_hostname & ".txt"

OutputFile = system_hostname & ".txt"

'OutputFile = "c:\output.txt"

'Set objFile = objFSO.CreateTextFile(OutputFile)

'wscript.sleep 10000

Set objTS = objFSO.OpenTextFile(OutputFile, FOR_APPENDING, True)

'Set objTS = objFSO.OpenTextFile(OutputFile,FOR_WRITING)

objTS.Write result



if debugging = "yes" then

wscript.echo "Done"

end if







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_short_name(os)

if InStr(os, " 95") then os_short_name="windows_old"

if InStr(os, " 98") then os_short_name="windows_old"

if InStr(os, " NT") then os_short_name="windows_old"

if InStr(os, "2000") then os_short_name="windows"

if InStr(os, " XP") then os_short_name="windows"

if InStr(os, "2003") then os_short_name="windows"

if InStr(os, "Vista") then os_short_name="windows_new"

if InStr(os, "2008") then os_short_name="windows_new"

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)

'WScript.Echo dtm:

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_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 = "44" then vers_name = "Microsoft Office InfoPath 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

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 = "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 = "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

get_sku_2003 = 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<BR/>" 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)

Const rpkOffset=52:i=28

szPossibleChars="BCDFGHJKMPQRTVWXY2346789"

Do 'Rep1

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 'Goto Rep1

GetKey=szProductKey

End Function[/code]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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

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