Skip to content

Instantly share code, notes, and snippets.

@jessewolcott
Created June 12, 2023 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessewolcott/258e90ac3a83d10698b7442b9ce13ae1 to your computer and use it in GitHub Desktop.
Save jessewolcott/258e90ac3a83d10698b7442b9ce13ae1 to your computer and use it in GitHub Desktop.
Uninstall
$ProductName = "XM Fax CE 23.1"
$UninstallStrings = @("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall") |`
foreach-object{Get-ChildItem -Path $_ |`
Get-ItemProperty |`
Select-Object DisplayName,UninstallString
}|`
Sort-Object |`
Where-Object {($_.DisplayName) -and ($_.DisplayName -match $ProductName)} |`
Sort-Object Displayname |`
Select-Object -ExpandProperty UninstallString
$UninstallStrings | Foreach-object{
$Commands = $_ -split ' '
If(($Commands).count -eq '2'){
$Code = (Start-process ($Commands[0]) -ArgumentList @(($Commands[1] -replace '/I','/X'),"/quiet") -wait -PassThru).ExitCode
Write-Output "Returned exit code $Code"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment