Kae Travis

Install and Uninstall an MSI using PowerShell

Posted on by in PowerShell

This is an example of how to install and uninstall an MSI using PowerShell.

It passes in a string array as the msiexec arguments. So you can add more arguments as you see fit. Pay close attention to the quotes around the file paths (in case they contain spaces).

$MSIInstallArguments = @(
"/i"
'"c:\alkane.msi"'
"/qb!"
"/norestart"
"/l*v"
'"C:\Temp\alkane_install_log.log"'
)
Start-Process "msiexec.exe" -ArgumentList $MSIInstallArguments -Wait -NoNewWindow 
$MSIUninstallArguments = @(
"/x"
"{0233CEF0-B5CD-40BB-AEAD-A131A547112E}"
"/qb!"
"/norestart"
"/l*v"
'"C:\Temp\alkane_uninstall_log.log"'
)
Start-Process "msiexec.exe" -ArgumentList $MSIUninstallArguments -Wait -NoNewWindow

 

Install and Uninstall an MSI using PowerShell
Install and Uninstall an MSI using PowerShell

Leave a Reply