Fixed warning message in UninstallProgram

This commit is contained in:
Zachary Gorman 2025-06-26 10:43:04 -07:00
parent d2e224cd69
commit 54ba4e28a5
4 changed files with 10 additions and 3 deletions

View file

@ -313,7 +313,7 @@
Write-Progress -Activity "Retrieving data from $Env:COMPUTERNAME" -Status "Querying Spark! for location details. Timeout $($timeout)s" -PercentComplete 95
$uri = if ($assetTag -ne '') {
"$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'"
} elseif ($serviceTag){
} elseif ($serviceTag -ne ''){
"$Tenant/api/odata/businessobject/cis`?`$filter=SerialNumber eq '$serviceTag'"
} else {
"$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$env:ComputerName'&`$top=1&`$skip=0"

View file

@ -219,7 +219,13 @@ $Headers = @{
Write-Progress -Activity "Getting SCCM data for $comp" -Status 'Querying for CMDB data' -PercentComplete $progress -ParentID 0 -Id $PCID
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$FindAssetTagSCCM'&`$top=1&`$skip=0"
$uri = if ($assetTag -ne '') {
"$Tenant/api/odata/businessobject/cis`?`$filter=AssetTag eq '$assetTag'"
} elseif ($serviceTag -ne ''){
"$Tenant/api/odata/businessobject/cis`?`$filter=SerialNumber eq '$serviceTag'"
} else {
"$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$env:ComputerName'&`$top=1&`$skip=0"
}
try {
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
if ($Query) {

View file

@ -31,7 +31,7 @@ function Invoke-UninstallProgram ($Computer) {
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Restarting $env:ComputerName" }
3010 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Please restart $env:ComputerName to finish uninstall" }
3011 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $env:ComputerName"; Write-Warning "Please restart $env:ComputerName to finish uninstall" }
default { Write-Warning "$appname failed to uninstall from $env:ComputerName with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
default { Write-Warning "$($apps[$item].Name) failed to uninstall from $env:ComputerName with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
}
}
}

View file

@ -6,6 +6,7 @@ Patch
-Fix UninstallProgram reports the hostname in the done message rather than blank
-Update Zebra printers report Ethernet or wifi. Detection method isn't officially documented by Zebra so could be faulty
-Fix PCLocal searches CMDB with the first non-null value in Asset Tag, Serial Number, and Name
-Fix UninstallProgram reports app name in warning message
Patch 2025-5-28
-Update SCCMQueryBlock uses asset tag to query Spark!