Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I return a list of all items in the Add/Remove programs list dialog?

How can I return a list of all items in the Add/Remove programs list dialog?

It is not possible to use SilkTest directly to retrieve a list of all items in the Add/Remove programs list. However it is possible to retrieve this data via the Registry. The attached script queries the reg files and produces a list of all programs, any program within the Add/Remove programs list contains 2 distinct keys i.e. "Display name" (that which is displayed in the Add/Remove programs list) and "Uninstall" (contains the uninstall path).

The attached code parses this list and then queries each in turn for the "Display" Key. IF found it prints the display name, if not an exception is thrown, but ignored (this is ok as the exception is only that the key looked for is not found).

This returns all that is in the Add/Remove programs list and all the windows security updates however this may be easily removed with some further scripting.

Note: This is not production code and may need refined/tested and is only provided as an example.

[ ] //Borland Code GShields 10/5/2006
[ ]
[ ] //Required .dll (Packaged with windows)
[ ] use "msw32.inc"
[ ]
[-] testcase GetInstalledApps () appstate none
[ ] //Get regvalue for reg entry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
[ ]
[ ] //Var Declorations
[ ] INTEGER iKey = HKEY_LOCAL_MACHINE // defined in msw32.inc
[ ] STRING sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
[ ] String sItem = "DisplayName"
[ ]
[ ] Integer i, Counter = 0
[ ] String sHolder = ""
[ ] List lRegkeys, lRegkeysunParsed
[ ]
[ ] //Get a list of all in the uninstall Key
[ ] lRegkeysunParsed = SYS_GetRegistryKeyNames (iKey, sPath)
[ ] ListPrint(lRegkeysunParsed)
[ ]
[ ] //convert to a string
[ ] STRING sTemp = lRegkeysunParsed[1]
[ ]
[ ] //Remove first and last { }
[ ] STRING sSubString = SubStr (sTemp, 2 ,len(sTemp))
[ ] sTemp = SubStr (sSubString, 1 ,len(sTemp)- 1)
[ ]
[ ] //Calculate the number of "," seporators
[-] for i = 1 to len(sTemp)
[ ]
[-] if sTemp == ("," )
[ ]
[ ] Counter = Counter + 1
[ ]
[ ]
[ ] //Create a list of the seprated Keys using ","
[ ] //Populates lRegkeys
[-] for i = 1 to Counter
[ ] sHolder = (GetField (sTemp, ", ", i) )
[ ] ListAppend(lRegkeys, sHolder)
[ ]
[ ] //Query each for Key "DisplayName" Key if Found Print
[-] for i = 1 to ListCount(lRegkeys)
[ ] //Reset Path after each loop
[ ] sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
[ ] sPath = sPath+"\"+lRegkeys
[-] do
[ ] String sRegValue = SYS_GetRegistryValue (iKey, sPath, sItem)
[ ] Print (SYS_GetRegistryValue (iKey, sPath, sItem))
[ ]
[-] except
[ ] //Ignore any keys where the required keys do not exist
[ ]
[ ]
[ ] //Borland Code GShields 10/5/2006


Old KB# 21080

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:16
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.