Page 1 of 1 1
Topic Options
#208341 - 2014-01-20 02:50 PM Software inventory (script vault) not getting all installed apps
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Paging Glenn, Glenn please report to the ER.

I started playing around with the inventory script posted in the script vault and noticed that the application inventory part is not getting all installed apps.

On my system I Installed a trial version of Adobe CS6 and it is not fully detected. Just to be sure it was not something fishy with the trial I also tried it on a system with a licensed version of CS6 and I get the same results. Dreamweaver and Fireworks for example are not detected.

I modified the exclusion section so that all checks to see if an application needs to be excluded fail and all applications will be reported but still no Fireworks and Dreamweaver.

Am I missing something, is Adobe doing some weird things with these applications or is there something wrong with the WMIInstalledProducts UDF in the script?

The code:
 Code:
Break on

$rc = RedirectOutput("D:\TestInventory.txt")

$AppData = WMIInstalledProducts() 

For $index = 0 to UBound($AppData)
	?
	? "Product Name: " + $AppData[$index][0]
	? "Product ID: " + $AppData[$index][1]
	? "Install Date: " + $AppData[$index][2]
	? "Install Path: " + $AppData[$index][3]
	? "Vendor: " + $AppData[$index][4]
	? "Version: " + $AppData[$index][5]
	? "Registered Owner: " + $AppData[$index][6]
	? "Registered Company: " + $AppData[$index][7]
Next

$rc = RedirectOutput("")

?
?"Done"


Sleep 200


;Region Software information
;FUNCTION       WMIInstalledProducts() 
; 
;ACTION         Reports the installed software products 
; 
;AUTHOR         Glenn Barnas 
; 
;VERSION        1.0 / 2014/01/10 
; 
;SYNTAX         WMIInstalledProducts([Host] [,AuthPtr]) 
; 
;PARAMETERS     host    - OPTIONAL - name of system to query 
; 
;               AuthPtr - OPTIONAL - pre-authenticated WMI object pointer 
;                 Use WMIAuthentication() udf to create the AuthPtr value 
;                 AuthPtr is not needed if user has admin rights 
; 
;REMARKS        Filters out secondary components of primary products 
; 
;RETURNS        An array of Arrays. Each inner array consists of the following values: 
;			0. Product Name 
;			1. Product ID 
;			2. Install Date (yyyymmdd) 
;			3. Install Path 
;			4. Vendor 
;			5. Version 
;			6. Registered Owner 
;			7. Registered Company 
; 
;DEPENDENCIES   WMI 
; 
;TESTED WITH    WXP, W2K3, W2K8, W2K12, Win7, Win8 
; 
;EXAMPLES        
; 
Function WMIInstalledProducts(OPTIONAL $_Target, $_pAuth)
	 
	Dim $_objWMIService, $_objItem, $_colItems 		; WMI Object pointer and collection vars 
	Dim $_Ok 						; Process flag 
	Dim $_P 						; Pointer var 
	Dim $_aData, $_aRec[7] 				; array of collected data, working record array 
	 
	$_P = -1
	 
	; insure a properly formatted computer name, default to local computer is not specified 
	$_Target = IIf(Not $_Target, '.', Join(Split($_Target, '\'), ''))
	 
	; If a pre-authenticated WMI object pointer was provided, use it, otherwise create a new object pointer 
	If $_pAuth
		$_objWMIService = $_pAuth
	Else
		$_objWMIService = GetObject('winmgmts:{impersonationLevel=impersonate}!\\' + $_Target + '\root\cimv2')
		If @ERROR Exit Val('&' + Right(DecToHex(@ERROR), 4)) EndIf
	EndIf
	 
	$_objWMIService = GetObject('winmgmts:\\' + $_Target + '\root\cimv2')
	$_colItems = $_objWMIService.ExecQuery('Select * from Win32_Product',, 48)
	 
	For Each $_objItem in $_colItems
		$_Ok = 1
		 
		; =========================================================================== 
		; The following SELECT/CASE block can be adjusted by the code author to  
		; filter out the secondary app components that don't need to be logged. 
		; Those provided here are an example of typical secondary components. 
		; =========================================================================== 
		
		Select
			;Case Not Trim($_objItem.InstallLocation) 		; Can't be blank 
			;	$_Ok = 0
			Case InStr($_objItem.InstallLocation, '1Common Files') ; Must be a unique folder, not common 
				$_Ok = 0
			Case InStr($_objItem.InstallLocation, '1\Users\') 	; exclude personal settings 
				$_Ok = 0
			Case InStr($_objItem.Name, '1MSVCRT') 		; Exclude MS Visual C Runtime 
				$_Ok = 0
			Case InStr($_objItem.Name, '1 Live ') 		; Exclude Live components 
				$_Ok = 0
			Case InStr($_objItem.Name, '1MUI') 			; Exclude language packs 
				$_Ok = 0
			Case InStr($_objItem.Name, '1Engine') 		; Exclude add-on 
				$_Ok = 0
			Case InStr($_objItem.Name, '1Wrapper') 		; Exclude add-on 
				$_Ok = 0
			Case InStr($_objItem.Name, '1Office Proof') Or InStr($_objItem.Name, "1vérification linguistique")		; Exclude office proofing tools (assumed installed if Office is installed) 
				$_Ok = 0
			Case InStr($_objItem.Name, '1IME') 			; Exclude office InputMethodEditor aka IME (assumed installed if Office is installed) 
				$_Ok = 0
		EndSelect
		; =========================================================================== 
		If $_Ok
			$_P = $_P + 1 					; increase the array size 
			ReDim Preserve $_aData[$_P] 			; extend the array 
			ReDim $_aRec[7]
			$_aRec[0] = $_objItem.Name
			$_aRec[1] = $_objItem.ProductID
			$_aRec[2] = $_objItem.InstallDate
			$_aRec[3] = $_objItem.InstallLocation
			$_aRec[4] = $_objItem.Vendor
			$_aRec[5] = $_objItem.Version
			$_aRec[6] = $_objItem.RegCompany
			$_aRec[7] = $_objItem.RegOwner
			$_aData[$_P] = $_aRec 				; store the record in the array 
		EndIf
	Next
	 
	$WMIInstalledProducts = $_aData 			; return the compound array 
	 
	Exit 0
	 
EndFunction
;endregion


Edited by Mart (2014-01-20 02:58 PM)
Edit Reason: Added the code.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#208343 - 2014-01-20 07:35 PM Re: Software inventory (script vault) not getting all installed apps [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Comment out the Select/EndSelect block and see what's returned. If those products include one of the excluded keywords, then either keep the block comment in place, or adjust it as necessary.

I put this together using the KixOMatic script and was overwhelmed by the list of "BS".. if you've commented the filter section out (I see you put a "1" in the compare) and still don't get a listing, it's not being found by WMI.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208345 - 2014-01-21 10:14 AM Re: Software inventory (script vault) not getting all installed apps [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hmmmm....that s*cks. Commenting out the entire filtering section doesn’t fix it. I guessed it was Adobe doing something fishy here because it did find Acrobat Reader and some CS6 helper apps but not the rest. I tested to see if it were just the applications that used to be developed by Macromedia but no luck, Photoshop is also not detected.

For now I'll disable the software detection part and see if I can find a "fix" so all applications are detected.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#208346 - 2014-01-21 12:38 PM Re: Software inventory (script vault) not getting all installed apps [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
If you do - re-publish the UDFs and I'll update the code in the Vault. I don't use any scripted inventory outside of my HelpDesk utility, and that doesn't check software beyond the O/S version and patch levels.

I run an older version of Photoshop and this code finds it. My version of CS doesn't run on Windows 8, but my old v6.0 does. If I start using it more than 5-6 times per year, I'll upgrade, but till then, its good enough for my needs. ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208864 - 2014-05-10 09:58 PM Re: Software inventory (script vault) not getting all installed apps [Re: Glenn Barnas]
Ulrich68 Offline
Just in Town

Registered: 2014-05-02
Posts: 1
Loc: Germany
think the Problem is the 32bit view on a x64 System.
In my Inventory code i run it twice with the alternate reg view on and off.
The result is different and i merge it.

Ulrich

Top
#208865 - 2014-05-11 01:42 PM Re: Software inventory (script vault) not getting all installed apps [Re: Ulrich68]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Software detection is done using WMI calls. Changing the AlternateRegistryView setting does not make a difference on the collection of applications. It might if you are using registry scraping techniques, but this example code does not.

Just to verify, I called the WMIInstalledProducts UDF with AlternateRegistryView On and Off and got exactly the same results running on Windows 8.0 x64.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208878 - 2014-05-13 08:34 PM Re: Software inventory (script vault) not getting all installed apps [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11627
Loc: CA
Well its been many years since I originally started my inventory script and over the years there are at least 2 major installation sections in the registry and a couple of "unique" ones. I called both before and then as Glenn used some excludes but it often still had some duplicates. I've not seen any product that is 100% on installed software myself. Most seem to have a similar issue in that they either miss applications or do duplicates as well. Though I'm sure one could probably use some type of regex coding to deal with duplicates. Unfortunately with working 2 full time jobs now and neither one requiring much scripting I don't really have the time to give that something like this would require.
Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 739 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.179 seconds in which 0.14 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org