I’m going to attempt a short post…
Sometimes it’s necessary to determine the version of Windows Installer present on a system. The installation package for new products may be designed to use a feature added to a specific version of Windows Installer. It can be helpful to know whether you need to upgrade Windows Installer before attempting deployment of the new product.
According to the Windows Installer Team, the best way to determine the version of Windows Installer is to examine the version of the “MSI.dll” file. The following PowerShell command lines do this.
NOTE: Sometimes I choose to issue individual PowerShell command lines rather than running a script. I’ll explain this later, but even for very long command lines, they can be pasted into the command window without any problems. It doesn’t matter if they wrap. Also, you can paste several lines at once.
The command lines are:
$OriginalErrorActionPreference = $ErrorActionPreference;
$ErrorActionPreference = 'SilentlyContinue';
Get-ChildItem -Path 'C:\Windows\Sys*[36][24]\' -Include ('MSI.dll', 'MSIExec.exe') -Recurse | Sort-Object -Property DirectoryName, Name | Select-Object -Property DirectoryName, Name, @{Name='FileSize';Expression={'{0:N0}' -f $_.Length}}, @{Name='LastWriteTime';Expression={$_.LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss')}}, @{Name='Version';Expression={[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.FullName).FileVersion;}} | Format-List;
$ErrorActionPreference = $OriginalErrorActionPreference;

