Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Code Snip to generate listing
Locator = ObjectOpen("WbemScripting.SWbemLocator") Service = Locator.ConnectServer("%Computername%") Security = Service.Security_ Security.ImpersonationLevel = 3 Adapters = Service.InstancesOf("Win32_Product") If LastError( ) == 1261 sComment="Error: WMI missing or not installed. %@CRLF% Utility will now exit." Message("WMI Test:", sComment) Exit endif hEnum = ObjectCollectionOpen(Adapters) Product = ObjectCollectionNext(hEnum) Count=0 Adapter="" While 1 Count=Count+1 AdapterType%Count% = Product.Name Adapter=StrCat(Adapter,@Tab,AdapterType%Count%) Product = ObjectCollectionNext(hEnum) If Product==0 Then Break EndWhile Adapter=STRTRIM(Adapter) Adapter=ItemSort(Adapter, @Tab) Applist=Adapter
I was unable to recreate the problem. WMI returned the same lists whether it was run locally, or accessed remotely....
Apparently Win32_Product only gives the names of software that is installed via ".msi" files...
Maybe you could use RegConnect then enumerate the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Service = Locator.ConnectServer(computername,"root/cimv2",username,password)That way you are absolutely sure the script is using the same user account to accesss the product information.
Here is some code that uses the REGGIE EXTENDER.
Note: this code was tested on WIndows Xp and Windows 2000.....
AddExtender("WWREG34I.DLL") computername = ""; LOCAL COMPUTER ;computername = "\\COMPUTER" ;for REMOTE COMPUTER string="WindowsInstaller" topkey=@REGMACHINE ; start at HKEY_CURRENT_USER topsub="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" handle = RegConnect(computername, topkey) looktype=1 ; look at REG_SZ string values lookat=2 ; look for wholestring matches only, in all registry types: Keys, Values, Data dosubtree=@FALSE ; do not return subtree contents retall=rRegSearch(handle,topsub,string,looktype,lookat,dosubtree) list = "" count=ItemCount(retall,@tab) For xx = 1 to count keypath = ItemExtract(xx,retall,@tab) newkey = StrReplace(keypath, string, "DisplayName") if RegExistValue(handle,newkey) name = RegQueryValue(handle,newkey) list = StrCat(list,@tab,name) endif Next list = StrReplace(StrTrim(list),@tab,@cr) message("Product list",list) exit
Article ID: W15870
File Created: 2004:03:30:15:41:14
Last Updated: 2004:03:30:15:41:14