Alguma maneira de saber qual MSI criou um arquivo no meu sistema?

Alguma maneira de saber qual MSI criou um arquivo no meu sistema?

Digamos que eu tenha um arquivo no meu sistema que foi colocado lá por um Windows Installer, mas não tenho certeza de qual (nesse caso, foi um dos muitos subinstaladores do Microsoft SQL Server).

Há algo que eu possa consultar que vincule esse arquivo ao instalador para que eu possa desinstalá-lo?

Responder1

Não acho que você possa rastrear cada arquivo individual até o instalador MSI. No entanto, o que você pode fazer é rastrear um local de instalação, se ele estiver preenchido pelo MSI nesta chave de registro

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\]

Aqui está um script que pode ajudá-lo com isso.

#Get MOF File Method
$mof = @'
#PRAGMA AUTORECOVER

[dynamic, provider("RegProv"),
ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")]
class InstalledProducts {
[key] string KeyName;
[read, propertycontext("DisplayName")] string DisplayName;
[read, propertycontext("DisplayVersion")] string DisplayVersion;
[read, propertycontext("InstallDate")] string InstallDate;
[read, propertycontext("InstallLocation")] string InstallLocation;
[read, propertycontext("InstallSource")] string InstallSource;
[read, propertycontext("Publisher")] string Publisher;
[read, propertycontext("EstimatedSize")] string EstimatedSize;
[read, propertycontext("UninstallString")] string UninstallString;
[read, propertycontext("WindowsInstaller")] string WindowsInstaller;
};

[dynamic, provider("RegProv"),
ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432node\\Microsoft\\Windows\\CurrentVersion\\Uninstall")]
class InstalledProducts32 {
[key] string KeyName;
[read, propertycontext("DisplayName")] string DisplayName;
[read, propertycontext("DisplayVersion")] string DisplayVersion;
[read, propertycontext("InstallDate")] string InstallDate;
[read, propertycontext("InstallLocation")] string InstallLocation;
[read, propertycontext("InstallSource")] string InstallSource;
[read, propertycontext("Publisher")] string Publisher;
[read, propertycontext("EstimatedSize")] string EstimatedSize;
[read, propertycontext("UninstallString")] string UninstallString;
[read, propertycontext("WindowsInstaller")] string WindowsInstaller;
};
'@
$mof | Out-file -encoding ascii $env:TMP\InstalledProductsMof.txt -Force
mofcomp.exe $env:TMP\InstalledProductsMof.txt 

Get-WmiObject -Namespace root\default -class InstalledProducts | Select DisplayName,DisplayVersion,InstallDate,InstallLocation, InstallSource,Publisher,EstimatedSize,UninstallString,WindowsInstaller 

# CLEAN-UP: Remove the WMI Classes you just created

Remove-WmiObject -Namespace root\default -class InstalledProducts 
Remove-WmiObject -Namespace root\default -class InstalledProducts32 

informação relacionada