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"
}

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
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

I figured it out guys...

$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"}

Answered 03/01/2013 by: connan23
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity