VBScript: Find iTunes product codes automatically (or any other product, by using product name)

Download “GetProductCode_blog.coretech.dk.zip” GetProductCode_blog.ctglobalservices.com_.zip – Downloaded 505 times –

Today I am working on a installation package for iTunes 10.5.

We have to deploy it via Configuration Manager 2007 R2.

Beforehand we used to manually insert all product codes in the uninstall/upgrade script, to make sure that all version of itunes and support programs was uninstalled.

This was because we have experienced problems when upgrading, without removing old version first.

Now I have created a function that automatically can search both 32bit and 64bit registry for a specific product, and return the product code which can be used for automatic uninstall.

Here is the script:

use the function as the following:

Download the script above for the full implementation

Next article decribes how to use it in a Uninstall/Install  aka. upgrade scenario. Find it here

Happy Scripting!

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at https://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack


  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops


  1. Wojciech Sciesinski October 21, 2011 at 9:51 - Reply

    Thanks for this solution!

    I wait for your next post.

  2. Jeremias November 2, 2011 at 10:30 - Reply

    “Next article will decribe how to use it in a Uninstall/Install aka. upgrade scenario”

    Really looking forward to enjoy this article to!

  3. Jeremias November 2, 2011 at 11:15 - Reply

    Ha Ha, wow, that was fast!

    Appreciate it!

    • Jakob Gottlieb Svendsen
      Jakob Gottlieb Svendsen November 2, 2011 at 11:26 - Reply

      ha ha! .. yeah! .. thanks for reminding for to finish the incomplete article! .. i had forgot all about it 🙂

  4. Gautam July 12, 2012 at 17:59 - Reply

    I am getting regiry values from
    However im using below path
    on 64 bit machine

    • Jakob Gottlieb Svendsen
      Jakob Gottlieb Svendsen July 13, 2012 at 11:49 - Reply

      Hello Guatam

      i have tested on 64bit and it Works.

      i just did an extra test, only checking only in “SOFTWAREMicrosoftWindowsCurrentVersionUninstall” for a product that did not appear in “SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall”.
      and it found it without problem.

      this was on 64bit Windows 8 machine (script was created and tested on Win7 64bit originally).

  5. ilyas April 18, 2014 at 15:28 - Reply

    thx for your excellent work
    i have use above script and detect the value but getting uninstall

Leave A Comment