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

Comments

Please log in to comment

Community Chosen Answer

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.

Answered 11/12/2012 by: FiveStar
White Belt

Please log in to comment

Answers

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

Answered 11/14/2012 by: captain_planet
Second Degree Brown Belt

  • 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.
Please log in to comment
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).

Answered 11/09/2012 by: bkelly
Red Belt

  • I don't wan tot install the software
  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment
-1

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

Answered 11/08/2012 by: msimike1970
White Belt

  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment
-1

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

Answered 11/09/2012 by: mekaywe
Brown Belt

  • OK....how does the VB script do the work? Am I missing something simple here?
    • 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
Please log in to comment
Answer this question or Comment on this question for clarity