update
This commit is contained in:
+13
-17
@@ -4,20 +4,17 @@
|
|||||||
$UNINSTALL_KEYS = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
|
$UNINSTALL_KEYS = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
|
||||||
$UNINSTALL_KEYS += Get-ChildItem -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
|
$UNINSTALL_KEYS += Get-ChildItem -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
|
||||||
|
|
||||||
Foreach ( $reg in $UNINSTALL_KEYS )
|
Foreach ( $reg in $UNINSTALL_KEYS ) {
|
||||||
{
|
## Get the uninstall key
|
||||||
## Get each uninstall key
|
|
||||||
$REG_PROPERTY = Get-ItemProperty -Path $reg.PSPath
|
$REG_PROPERTY = Get-ItemProperty -Path $reg.PSPath
|
||||||
|
|
||||||
## Get the display name of the app
|
## Get the display name of the app
|
||||||
$DISPLAY_NAME = $REG_PROPERTY.DisplayName
|
$DISPLAY_NAME = $REG_PROPERTY.DisplayName
|
||||||
|
|
||||||
## Make sure the DisplayName matches what we're looking for
|
## Make sure the DisplayName matches what we're looking for
|
||||||
If ( $DISPLAY_NAME -ilike $APP_NAME )
|
If ( $DISPLAY_NAME -ilike $APP_NAME ) {
|
||||||
{
|
|
||||||
## Make sure the software was installed using an MSI
|
## Make sure the software was installed using an MSI
|
||||||
If ( $REG_PROPERTY.WindowsInstaller -eq 1 )
|
If ( $REG_PROPERTY.WindowsInstaller -eq 1 ) {
|
||||||
{
|
|
||||||
## Get the install location
|
## Get the install location
|
||||||
If ( $REG_PROPERTY.InstallLocation ) { $INSTALL_LOCATION = $REG_PROPERTY.InstallLocation }
|
If ( $REG_PROPERTY.InstallLocation ) { $INSTALL_LOCATION = $REG_PROPERTY.InstallLocation }
|
||||||
|
|
||||||
@@ -28,17 +25,16 @@ Foreach ( $reg in $UNINSTALL_KEYS )
|
|||||||
ElseIf ( $REG_PROPERTY.ModifyPath ) { $PRODUCT_CODE = $REG_PROPERTY.ModifyPath.Replace('MsiExec.exe /X','') }
|
ElseIf ( $REG_PROPERTY.ModifyPath ) { $PRODUCT_CODE = $REG_PROPERTY.ModifyPath.Replace('MsiExec.exe /X','') }
|
||||||
|
|
||||||
## Uninstall the app
|
## Uninstall the app
|
||||||
If ( $PRODUCT_CODE )
|
If ( $PRODUCT_CODE ) {
|
||||||
{
|
LogMsg "Uninstalling ${DISPLAY_NAME} ${PRODUCT_CODE}"
|
||||||
Write-Output "Uninstalling ${DISPLAY_NAME} ${PRODUCT_CODE}"
|
Try { Start-Process -FilePath "msiexec.exe" -ArgumentList "/X${PRODUCT_CODE} /qn /norestart" -Wait }
|
||||||
#Start-Process -FilePath "msiexec.exe" -ArgumentList "/X${PRODUCT_CODE} /qn /norestart" -Wait
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
|
||||||
If ( $INSTALL_LOCATION )
|
If ( $INSTALL_LOCATION ) {
|
||||||
{
|
If ( Test-Path $INSTALL_LOCATION ) {
|
||||||
If ( Test-Path $INSTALL_LOCATION )
|
LogMsg "Deleting install directory"
|
||||||
{
|
Try { Remove-Item $INSTALL_LOCATION -Recurse -Force }
|
||||||
Write-Output "Deleting install directory"
|
Catch { LogErr $_.Exception.Message }
|
||||||
#Remove-Item $INSTALL_LOCATION -Recurse -Force
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user