Monday, June 15, 2009

Checking to see Microsoft Report Viewer 2008 SP1 has been installed

We are updating the installer for one of our applications and that app now requires the Microsoft Report Viewer 2008 Service Pack 1 to be installed first.  The fun part is determining if it’s installed or not.  Usually, I check the registry keys to see if an application is installed.  If the user has installed the Report Viewer as a separate application, you’ll find it under the key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Report Viewer Redistributable 2008 SP1

If you want to read a value from that key, look for VersionMajor.  It should be a DWORD value of 1.

Of course that’s not the only way to get Report Viewer SP1 installed.  If you have Visual Studio 2008 and you have applied SP1, then you’ll have Report Viewer SP1 as part of the Service Pack.  Under that scenario, you wont have the “Microsoft Report Viewer Redistributable 2008 SP1” key. 

What you need to do is to check to see if VS 2008 SP1 is installed.  That key is located at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\KB945140

If you want to read a value for that key, look for string value for “PID”.

[Update on 6/16]

From the home office in Latham, NY, a reader sent in the suggested to also check the registry for 64 bit based machines.  On 64-bit editions of Windows, the Report Viewer Redistributable runs in 32-bit more.  It sees a virtualized version of the registry.  The actual registry location is

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Report Viewer Redistributable 2008 SP1

Note the “Wow6432Node”, that tells that it’s a 32 bit application installed on a 64 bit OS.

7 comments:

  1. I just installed the Report viewer SP1, and checked for these registry paths, but no use.
    Any ideas?

    ReplyDelete
  2. Ahmed,

    Under what OS did you install it under? Was it 32 or 64 bit. Was this a machine with VS2008 already installed or a clean machine?

    ReplyDelete
  3. Hi, I've installed the report viewer on a Windows Server 2003 64 bit server, but I am unable to find any reference to the report viewer package in the registry. I've searched the entire registry for "Microsoft Report Viewer" and the KB number with no luck. Any other suggestions would be greatly appreciated. Thanks.

    ReplyDelete
  4. Matt,

    I just checked one of my Server 2003 64-bit machines with regedit and it had the key for HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Report Viewer Redistributable 2008 SP1

    How did you install the Report Viewer Redistributable? Does it appear as it's own under Add/remove programs?

    ReplyDelete
  5. Chris, I think I found the source of my frustration. The developer who "installed" this did so by only copying over the assemblies rather than running through the installer. Hence, no registry keys or entries in Add/Remove Programs. Thanks for your assistance and sorry to send you on a goose chase.

    ReplyDelete
  6. Hello Matt,

    I want to programmatically check whether the reportviewer is installed. I'm using the registry key SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Microsoft Report Viewer Redistributable 2008 (KB971119)bcoz .. the last part of key Microsoft Report Viewer Redistributable 2008 SP1 didn't work for me...Is that (KB971119) specific to my system... Because I need to check for installation in many systems...

    ReplyDelete
  7. On a Win7 machine, the 32-bit stuff is in fact under Wow6432Node ...

    A WORD ABOUT Windows INSTALLERS:

    Every installer, whether it be MSI or SETUP.EXE, has a "product code" GUID which is used to identify and uninstall it.

    If you look in HKLM for
    SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C19B3EB6-B54C-3204-A4DF-88432E0C79F7}

    you will find several entries:
    DisplayName: the name of the product
    DisplayVersion: the displayed version of the product
    UninstallString: What you run from the command line to uninstall this product.
    Notice that one has the same GUID:

    MsiExec.exe /X{C19B3EB6-B54C-3204-A4DF-88432E0C79F7}

    So that's the command which you would use in a batch file to uninstall the Microsoft ReportViewer 2010 redistributable version 10.0.30319.

    If you want more information, after installing or uninstalling a product, you will likely find a log file of the installation in the most-recently-modified files within the %temp% folder.
    Within the log file, you will find references to product code GUIDs such as

    "MsiGetProductInfo with product code {C19B3EB6-B54C-3204-A4DF-88432E0C79F7} found no matches"

    Be sure to type "msiexec.exe /?" to get a list of all the command-line options.

    ReplyDelete

Note: Only a member of this blog may post a comment.