change app tracking from int to bool

This commit is contained in:
2023-01-18 19:22:52 -05:00
parent 3ada68d37f
commit aa6c5f0179
+3 -3
View File
@@ -25,7 +25,7 @@ Foreach ( $reg in $UNINSTALL_KEYS ) {
$MODIFYPATH = $REG_PROPERTY.ModifyPath $MODIFYPATH = $REG_PROPERTY.ModifyPath
# Track whether an app was uninstalled or not # Track whether an app was uninstalled or not
$PRODUCTUNINSTALLED = 0 $PRODUCTUNINSTALLED = $false
# 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 ) {
@@ -41,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 ; $PRODUCTUNINSTALLED++ } Try { Start-Process -FilePath "msiexec.exe" -ArgumentList $arguments -Wait ; $PRODUCTUNINSTALLED = $true }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
} }
} }
@@ -49,5 +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"} If ( $PRODUCTUNINSTALLED -eq $false ) { LogMsg "No product matching ${APP_NAME} was found"}
} }