Cómo encontrar el código de actualización y el código de producto de una aplicación instalada en Windows 7


Tengo una aplicación instalada en mi máquina. También tengo su código fuente, pero de alguna manera se cambiaron el código de producto y el código de actualización de esta aplicación.

Ahora quiero obtener el código de actualización y el código de producto de esta aplicación instalada. Creo que debe haber alguna herramienta para esto.

¿Puede alguien amablemente hacerme saber cómo obtener el código de actualización y el código de producto de una aplicación instalada?

Author: Martin Prikryl, 2011-02-21

10 answers


IMPORTANTE: Ha pasado un tiempo desde que se publicó originalmente esta respuesta, y a las personas inteligentes se les ocurrieron respuestas más sabias. Compruebe ¿Cómo puedo encontrar el código de actualización para un archivo MSI instalado? de @ Stein Åsmul si necesita un enfoque sólido e integral.


Aquí hay otra manera (no necesitas herramientas):

  • abra el registro del sistema y busque la clave HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (si se trata de un instalador de 32 bits en una máquina de 64 bits, podría estar bajo HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall en su lugar).
  • los GUID enumerados bajo esa clave son los productos instalados en esta máquina
  • encuentra el que estás hablando-solo paso uno por uno hasta que veas su nombre en el panel derecho

Este GUID en el que te detuviste es el código del producto.

Ahora, si está seguro de que la reinstalación de esta aplicación saldrá bien, puede ejecutar la siguiente línea de comandos:

Msiexec / i {PRODUCT-CODE-GUID-HERE} REINSTALL = ALL REINSTALLMODE = omus / l * v registro.txt

Esto "reparará" su aplicación. Ahora mira el archivo de registro y busca "UpgradeCode". Este valor se vierte allí.

NOTA: solo debe hacer esto si está seguro de que reinstall flow está implementado correctamente y esto no romperá su aplicación instalada.

 64
Author: Yan Sklyarenko,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-11 07:23:43

Se necesita algún tiempo para devolver los resultados, fácilmente muchas decenas de segundos, pero wmic funciona bien y puede ser escrito:

wmic product where "Name like '%Word%'" get Name, Version, IdentifyingNumber

Resultado:

IdentifyingNumber                       Name                                      Version
{90140000-001B-0409-0000-0000000FF1CE}  Microsoft Office Word MUI (English) 2010  14.0.6029.1000

El IdentifingNumber es el código del producto. No vi una propiedad para UpgradeCode, pero tal vez podría estar enterrada bajo otra cosa. Véase http://quux.wiki.zoho.com/WMIC-Snippets.html para muchos otros ejemplos, incluyendo uninstall :

wmic path win32_product where "name = 'HP Software Update'" call Uninstall
 16
Author: matt wilkie,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-25 23:56:04

A todos usando:

Get-WMIObject win32_product

Debe tener en cuenta que esto ejecutará una autocuración en cada aplicación MSI instalada en el PC. Si comprueba eventvwr, dirá que ha terminado de reconfigurar cada producto.

En este caso utilizo lo siguiente (una mezcla del método de Yan Sklyarenko):

$Reg = @( "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" )
$InstalledApps = Get-ItemProperty $Reg -EA 0
$WantedApp = $InstalledApps | Where { $_.DisplayName -like "*<part of product>*" }

Ahora si usted fuera a escribir:

$WantedApp.PSChildName

Se le dará lo siguiente:

PS D:\SCCM> $WantedApp.PSChildName
{047904BA-C065-40D5-969A-C7D91CA93D62}

Si su organización utiliza un montón de MST durante la instalación las aplicaciones que desea evitar ejecutar auto-cura encierran que revierten algunos ajustes cruciales.

  • Nota: Esto encontrará el código de su producto, luego la actualización se puede encontrar como Yan mencionó. Yo por lo general, sin embargo, solo utilizar cualquiera 'InstEd!'or' Orca ' luego vaya a la tabla de propiedades del MSI y las enumera justo en la parte superior.
 10
Author: xBr0k3n,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-09-24 08:33:51

Si tiene instalador msi, ábralo con Orca (herramienta de Microsoft), propiedad de tabla (rows UpgradeCode, ProductCode, Product version, etc.) o Código de actualización de columna de actualización de tabla.

Trate de encontrar instller a través del registro: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall find subkey required and watch value InstallSource. Tal vez en el camino usted será capaz de encontrar el archivo MSI.

 8
Author: vinogradniy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-28 10:03:43

Powershell maneja tareas como esta con bastante facilidad:

$productCode = (gwmi win32_product | `
                ? { $_.Name -Like "<PRODUCT NAME HERE>*" } | `
                % { $_.IdentifyingNumber } | `
                Select-Object -First 1)

Luego puede usarlo para obtener la información de desinstalación también:

$wow = ""
$is32BitInstaller = $True # or $False

if($is32BitInstaller -and [System.Environment]::Is64BitOperatingSystem) 
{
    $wow = "\Wow6432Node" 
}

$regPath = "HKEY_LOCAL_MACHINE\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall"

dir "HKLM:\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall" | `
? { $_.Name -Like "$regPath\$productCode"  }
 6
Author: codekaizen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-10 16:52:31

En la compilación de vista previa de Windows 10 con PowerShell 5 , puedo ver que puede hacer:

$info = Get-Package -Name YourInstalledProduct
$info.Metadata["ProductCode"]

No estoy familiarizado con ni siquiera estoy seguro de si todos los productos tienen UpgradeCode, pero de acuerdo con este post necesita buscar UpgradeCode desde esta ruta de registro:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes

Desafortunadamente, los valores de las claves del registro son el código de producto y las claves del registro son el código de actualización.

 3
Author: batbaatar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-11 19:55:54

Puede usar los métodos MsiEnumProductsEx y MsiGetProductInfoEx para enumerar todas las aplicaciones instaladas en su sistema y hacer coincidir los datos con su aplicación

 2
Author: Ciprian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-02-21 09:42:56

Otra solución demasiado complicada, con la ventaja de no tener que volver a instalar la aplicación como requería la solución anterior. Esto requiere que tenga acceso al msi (o a una configuración.exe con el msi integrado).

Si tiene Visual Studio 2012 (o posiblemente otras ediciones) e instala el "InstallShield LE" gratuito, entonces puede crear un nuevo proyecto de instalación usando InstallShield.

Una de las opciones de configuración en el paso" Organizar la configuración " se llama "Upgrade Paths" (en inglés). Abra las propiedades de las rutas de actualización y, en el panel izquierdo, haga clic con el botón derecho en "Rutas de actualización" y seleccione "Nueva ruta de actualización" ... ahora vaya al msi (o configuración.exe que contiene el msi) y haga clic en "abrir". El código de actualización se completará para usted en la página configuración en el panel derecho que ahora debería ver.

 0
Author: TCC,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-24 20:00:15

No había encontrado ninguna manera de averiguar el código de actualización de una aplicación instalada, antes de ver Yan Sklyarenko's solución (actualmente) arriba. Pero si usted / cualquier otra persona encontraría una manera de averiguar (al menos) tanto UpgradeCode como ProductCode desde un MSI, siga leyendo.

De http://www.dwarfsoft.com/blog/2010/06/22/msi-package-code-fun / , modificado para permitir (cuando se lanza con wscript.exe) una caja emergente de información por MSI (Trunicado a 1023 caracteres, debido a wscript.echo limitación); capaz de introducir MSI (s) desde la GUI, así como la CLI; alguna validación de entrada humana básica; código de depuración eliminado ('Set oDatabase) y 1 corrección de error (DB.OpenView).

'Created by:   Chris Bennett
'Created Date: 22/06/2010
'Description:
'   Opens up MSI file(s) Passed as Arguments & returns ProductName, ProductCode,
'   The HKCR key created from ProductCode (a Packed GUID of ProductCode), the 
'   PackageCode and the UpgradeCode of the MSI. Much quicker than getting these
'   out of the MSI's the Manual Way.

References:
http://msdn.microsoft.com/en-us/library/aa369794%28VS.85%29.aspx http://www.eggheadcafe.com/forumarchives/platformsdkmsi/Jan2006/post25948124.asp

if wscript.arguments.count = 0 then
  MSIs = inputbox("Enter in * delimited list of MSI's to query (Max 254 characters)", "MSI Product Details")
  MSIs = split(MSIs,"*")
else
  set MSIs = wscript.arguments
end if

set objFS = createobject("scripting.filesystemobject")
For Each MSIPath in MSIs
  if objFS.fileexists(MSIPath) then
    Set MSIDetails = EvaluateMSI(MSIPath)
    MSIDetails = MSIPath & ": " & vbcrlf & vbcrlf & "Product Name: " &_
    MSIDetails("ProductName") & vbcrlf & "Product Code: " &_
    MSIDetails("ProductCode") & vbcrlf & "Product Key : " &_
    "HKCR\Installer\Products\" & PackGUID(MSIDetails("ProductCode")) &_
    vbcrlf & "Package Code: " & MSIDetails("PackageCode") & vbcrlf &_
    "Upgrade Code: " & MSIDetails("UpgradeCode") & vbcrlf
    WScript.Echo MSIDetails
  else
    wscript.echo "Inaccessible; Non-existant; or Error in Path for:" & vbcrlf & MSIPath & vbcrlf & "... skipping"
  end if
Next

Function EvaluateMSI(MSIPath)
  On Error Resume Next
  ' create installer object
  Set oInstaller = CreateObject("WindowsInstaller.Installer")
  ' open msi in read-only mode
  Set oDatabase = oInstaller.OpenDatabase(MSIPath, 0)
  Set objDictionary = CreateObject("Scripting.Dictionary")
  ' Get Package Code from Summary Information Stream   
  Set streamobj = oDatabase.SummaryInformation(0) '0 = read only
  objDictionary("PackageCode") = streamobj.Property(9)
  ' Get Product Name from MSI Database
  Set View = oDatabase.OpenView("Select `Value` From Property WHERE `Property`='ProductName'")
  View.Execute
  Set ProductName = View.Fetch
  objDictionary("ProductName") = ProductName.StringData(1)

  ' Get Product Code from MSI Database
  Set View = oDatabase.OpenView("Select `Value` From Property WHERE `Property`='ProductCode'")
  View.Execute
  Set ProductCode = View.Fetch
  objDictionary("ProductCode") = ProductCode.StringData(1)

  ' Get Upgrade Code from MSI Database
  Set View = oDatabase.OpenView("Select `Value` From Property WHERE `Property`='UpgradeCode'")
  View.Execute
  Set UpgradeCode = View.Fetch
  objDictionary("UpgradeCode") = UpgradeCode.StringData(1)

  Set EvaluateMSI = objDictionary
  On Error Goto 0
End Function

Function PackGUID(guid)  
  PackGUID = ""  
  '*  
  Dim temp  
  temp = Mid(guid,2,Len(guid)-2)  
  Dim part  
  part = Split(temp,"-")  
  Dim pack  
  pack = ""  
  Dim i, j  
  For i = LBound(part) To UBound(part)
    Select Case i
      Case LBound(part), LBound(part)+1, LBound(part)+2
        For j = Len(part(i)) To 1 Step -1  
          pack = pack & Mid(part(i),j,1)  
        Next  
      Case Else
        For j = 1 To Len(part(i)) Step 2  
          pack = pack & Mid(part(i),j+1,1) & Mid(part(i),j,1)  
      Next  
    End Select
  Next  
  '*  
  PackGUID = pack  
End Function

Si uno necesita copiar y pegar cualquiera de los GUID en la ventana emergente, tiendo a encontrar más fácil usar un caja de entrada posterior, como inputbox "","",MSIDetails

 0
Author: user66001,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:25:54

Si no tiene el msi y necesita el código de actualización, en lugar del código de producto, entonces la respuesta está aquí: ¿Cómo puedo encontrar el código de actualización para una aplicación instalada en C#?

 0
Author: krispy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:54:31