Uninstalling MSI using Powershell HELP
I'm trying to uninstall snagit 10(if it's installed on the machine) using powershell by using the script below but
it prompts a window asking if I want to keep or remove user data during uninstallation. In order to suppress this in msiexec.
I can use msiexec /x snagit10.smi tsc_data_store-1 qn and it works. how do I do that using powershell using uninstall()
$Result = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Snagit 10.0.2" }
if ($result.name -eq “Snagit 10.0.2”){
$result.uninstall()
}
else {
write-host "Snagit 10 is not installed"
}
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
$Result = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Snagit" } if($result.name -eq “Snagitâ€){cmd /c "msiexec /uninstall SnagIT.msi TSC_DATA_STORE=1 /qn"} - See more at: http://www.itninja.com/question/uninstalling-msi-using-powershell-help#sthash.wl3wCJTu.dpuf
$Result = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Snagit" } if($result.name -eq “Snagitâ€){cmd /c "msiexec /uninstall SnagIT.msi TSC_DATA_STORE=1 /qn"} - See more at: http://www.itninja.com/question/uninstalling-msi-using-powershell-help#sthash.wl3wCJTu.dpuf
Please log in to answer
Posted by:
connan23
11 years ago