/build/static/layout/Breadcrumb_cap_w.png

Want to find the GUID of an MSI installation

I want to be able to find out what the GUID will be for the uninstall string of an MSI package.

I want to do this without installing the package and since I have to do this for more than 100 MSIs a command line or data dump of an msi I can mine the data out of is preferred.

 

help?????

 

mike

 


0 Comments   [ + ] Show comments

Answers (5)

Posted by: FiveStar 12 years ago
White Belt
2

Without installing the MSI you can use Orca, a free download from Microsoft contained in the Platform SDK.  It is the tool they use to create, edit MSI files.  Once you open the MSI with Orca look in the Properties Table and look for the Prodcut ID which is the GUID you are looking for.

Posted by: captain_planet 12 years ago
Black Belt
1

You can use something like this which I've quickly knowcked up.  Paste it into a file, say uninstallString.vbs. Usage is:

Open a CMD prompt

Type: Cscript uninstallString.vbs <path to root folder containing all MSIs)

 

Things to do:

Error trapping

Write results to log file instead of CMD prompt

Retrieve Product Name?

The Script:

 

 Set objFSO = CreateObject("Scripting.FileSystemObject")

'set this to the root folder which contains all the MSIs in subfolders
objStartFolder = wscript.arguments(0)

Set objFolder = objFSO.GetFolder(objStartFolder)

Set colFiles = objFolder.Files
For Each objFile in colFiles
    wscript.echo objFile.Path
    wscript.echo GetProductCode(objFile.Path)
Next
Wscript.Echo

ShowSubfolders objFSO.GetFolder(objStartFolder)

Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
        Set objFolder = objFSO.GetFolder(Subfolder.Path)
        Set colFiles = objFolder.Files
        For Each objFile in colFiles
             wscript.echo objFile.Path
             wscript.echo GetProductCode(objFile.Path)
        Next
        Wscript.Echo
        ShowSubFolders Subfolder
    Next
End Sub


Function GetProductCode(ByVal msiPath)

    Const msiOpenDatabaseModeReadOnly = 0
    Dim msi, db, view

    Set msi = CreateObject("WindowsInstaller.Installer")
    Set db = msi.OpenDataBase(msiPath, msiOpenDatabaseModeReadOnly)
    Set view = db.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductCode'")
    view.Execute()

    GetProductCode = "MSIEXEC /X " & view.Fetch().StringData(1) & " /QN"

End Function


Comments:
  • I am no good at programming but I've changed the Function to display some more useful info if you want to use them for version checking etc:

    Function GetProductCode(ByVal msiPath)

    Const msiOpenDatabaseModeReadOnly = 0
    Dim msi, db, prodcode, prodname, prodversion

    Set msi = CreateObject("WindowsInstaller.Installer")
    Set db = msi.OpenDataBase(msiPath, msiOpenDatabaseModeReadOnly)
    Set prodcode = db.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductCode'")
    Set prodname = db.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductName'")
    Set prodversion = db.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductVersion'")
    prodcode.Execute()
    prodname.Execute()
    prodversion.Execute()

    GetProductCode = "Name " & prodname.Fetch().StringData(1) & " Version " & prodversion.Fetch().StringData(1) & " Uninstall string " & prodcode.Fetch().StringData(1)

    End Function

    I would like to be able to display if the MSI is 32 or 64bit only but I don't know how to determine that from the MSI. - csjjpm 10 years ago
Posted by: bkelly 12 years ago
Red Belt
0

I'm sure you could do it with a script, but what I usually do is look in the registry where the Add Remove Programs (ARP) data is at

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall 

Do a search from here for your software name or just browse through-- the subkey for each product is it's GUID (at least for all the MSI setups).


Comments:
  • I don't wan tot install the software - msimike1970 12 years ago
Posted by: msimike1970 12 years ago
White Belt
-1

I think I have a workaround that has nothing to do with MSIs but would still like to find out this info


Comments:
Posted by: mekaywe 12 years ago
Brown Belt
-1

a VBScript will do it but for each MSI the script should be run on each MSI atleast once to get the GUID


Comments:
  • OK....how does the VB script do the work? Am I missing something simple here? - msimike1970 12 years ago
    • I know this is a bit old but if you MSIs are in c:\myinstallers then you do this
      cscript uninstallstring.vbs c:\myinstallers
      then it should list each MSI with its uninstall string - csjjpm 10 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ