Read the information in Control Panel - Add/Remove Programs 
Author Message
 Read the information in Control Panel - Add/Remove Programs

Hi

Is there a way to read out the entries in Add/Remove Programms (Control
Panel) - to get the software inventory on Windows 2000

Thanks in advance
Kurt



Wed, 03 Aug 2005 15:57:10 GMT  
 Read the information in Control Panel - Add/Remove Programs
Via Registry.


Quote:
> Hi

> Is there a way to read out the entries in Add/Remove Programms (Control
> Panel) - to get the software inventory on Windows 2000

> Thanks in advance
> Kurt



Wed, 03 Aug 2005 17:09:14 GMT  
 Read the information in Control Panel - Add/Remove Programs
You have to enumerate the keys in:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall

Eack key represents something installed. The main values:

 DisplayName - text to show in line of Add/Remove. If the value is missing
the program won't be listed.

UninstallString - command path for uninstall file. If missing Windows will
be
unable to uninstall the software.

  If you look at the key you're likely to see that a number of irrelevant
items
are listed there for products that no longer exist. Windows doesn't seem to
always delete the key when a product is uninstalled (or maybe some of those
bad keys are the result of third-party software writing its own keys).
 For instance, I have a key on my system, with IE5.0,  named "IE40".
It has no values.

   So you have to get the key names, check for DisplayName value, and
weed out the keys from your listing that don't have a DisplayName value
and an UninstallString value with a valid file path. Unfortunately, there's
no
way to easily cross reference display names to confirm them. The App Paths
key names subkeys by EXE file name, while the DisplayName value is
the program name, which may or may not correspond to a program folder
name.

   Then there's the issue of valid UninstallString values with no
DisplayName
value, a trick that MS seems to use to make things "unremovable". If you
want to display those you'll need to read the uninstall file to find out
what it
points to.

(  On WinXP: If you're displaying the removable programs and want to
cooperate with the list of programs that XP hides from the list, you need
to read the INF\sysoc.inf file and drop from your list anything that's
listed with a "hide" parameter in the sysoc.inf file. )

  VBS can't enumerate keys by itself.  If you want a component to do it:
  http://www.jsware.net/jsware/scripts.html
  ( see the JSSys3 component)

--
--

Quote:
> Hi

> Is there a way to read out the entries in Add/Remove Programms (Control
> Panel) - to get the software inventory on Windows 2000

> Thanks in advance
> Kurt



Thu, 04 Aug 2005 00:39:19 GMT  
 Read the information in Control Panel - Add/Remove Programs

Quote:

> Is there a way to read out the entries in Add/Remove Programms (Control
> Panel) - to get the software inventory on Windows 2000

Hi

Here is a script that on a local or remote computer enumerates the Uninstall
part in registry using WMI (WMI comes default with WinME, Win2k and WinXP).

Run it with cscript.exe from a command prompt for a demo:

sComputerName = "."     ' use "." for local computer

sInstApps = InstalledApplications(sComputerName)

' text block
WScript.Echo "As text block start..." & vbCrLf
WScript.Echo sInstApps
WScript.Echo "As text block stop..." & vbCrLf

' Convert to Array
aInstApps = Split(sInstApps, vbCrlf)

WScript.Echo "As array elements start..." & vbCrLf
For Each sApp In aInstApps
  If sApp <> "" Then
    WScript.Echo sApp
  End If
Next

WScript.Echo "As array elements stop..." & vbCrLf

' alternatively
'For i = 0 To UBound(aInstApps)
'  If aInstApps(i) <> "" Then
'    WScript.Echo aInstApps(i)
'  End If
'Next

Function InstalledApplications(node)
 Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
 Set oRegistry = _
  GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
  & node & "/root/default:StdRegProv")
 sBaseKey = _
  "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
 iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
 For Each sKey In arSubKeys
  iRC = oRegistry.GetStringValue( _
   HKLM, sBaseKey & sKey, "DisplayName", sValue)
  If iRC <> 0 Then
   oRegistry.GetStringValue _
    HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
  End If
  If sValue <> "" Then
   InstalledApplications = _
    InstalledApplications & sValue & vbCrLf
  End If
 Next
End Function

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Thu, 04 Aug 2005 02:47:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Get Software List on Add/Remove Programs (in Control Panel)

2. Adding an entry to the Add Remove Programs list

3. using WSH to uninstall programs (add/remove programs)

4. Add/Remove Programs

5. How to get application names and DateLastAccessed from add/remove programs (from a vbscript)

6. Removing ActiveX Controls from Downloaded Program Fies Directory

7. Hosted clients control panel

8. manadging windows network control panel with a sript????

9. Control panel

10. Control Panel Applet Shortcut

11. Control Panel Passwords applet

12. Control panel applet

 

 
Powered by phpBB® Forum Software