Compare commits

..
2 Commits
Author SHA1 Message Date
dyoder 3ada68d37f fix app matching for uninstall 2023-01-18 19:14:05 -05:00
dyoder 933105f0bf log msg if no product was uninstalled 2023-01-18 19:13:41 -05:00
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ If ( IsAdmin )
If ( IsURLValid $URL ) If ( IsURLValid $URL )
{ {
# Uninstall all versions of SketchUp # Uninstall all versions of SketchUp
$APP_NAME = "SketchUp" $APP_NAME = "SketchUp*"
Run-Script -LivePSScript Uninstall-MSI Run-Script -LivePSScript Uninstall-MSI
# Set the local file name to download to # Set the local file name to download to
+5 -1
View File
@@ -24,6 +24,9 @@ Foreach ( $reg in $UNINSTALL_KEYS ) {
# Get the ModifyPath # Get the ModifyPath
$MODIFYPATH = $REG_PROPERTY.ModifyPath $MODIFYPATH = $REG_PROPERTY.ModifyPath
# Track whether an app was uninstalled or not
$PRODUCTUNINSTALLED = 0
# 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
@@ -38,7 +41,7 @@ Foreach ( $reg in $UNINSTALL_KEYS ) {
If ( $PRODUCT_CODE ) { If ( $PRODUCT_CODE ) {
LogMsg "Uninstalling ${DISPLAY_NAME} ${PRODUCT_CODE}" LogMsg "Uninstalling ${DISPLAY_NAME} ${PRODUCT_CODE}"
$arguments = '/X{' + $PRODUCT_CODE + '} /qn /norestart' $arguments = '/X{' + $PRODUCT_CODE + '} /qn /norestart'
Try { Start-Process -FilePath "msiexec.exe" -ArgumentList $arguments -Wait } Try { Start-Process -FilePath "msiexec.exe" -ArgumentList $arguments -Wait ; $PRODUCTUNINSTALLED++ }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
} }
} }
@@ -46,4 +49,5 @@ Foreach ( $reg in $UNINSTALL_KEYS ) {
LogMsg "Cannot uninstall ""${DISPLAY_NAME}""`n UninstallString: ${UNINSTALLSTRING}" LogMsg "Cannot uninstall ""${DISPLAY_NAME}""`n UninstallString: ${UNINSTALLSTRING}"
} }
} }
If ( $PRODUCTUNINSTALLED -gt 0 ) { LogMsg "No product matching ${APP_NAME} was found"}
} }