diff --git a/Get-PC/Private/PCLocal.ps1 b/Get-PC/Private/PCLocal.ps1 index 2dd5a2c..ac13e14 100644 --- a/Get-PC/Private/PCLocal.ps1 +++ b/Get-PC/Private/PCLocal.ps1 @@ -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" diff --git a/Get-PC/Private/SCCMQueryBlock.ps1 b/Get-PC/Private/SCCMQueryBlock.ps1 index f176907..df377aa 100644 --- a/Get-PC/Private/SCCMQueryBlock.ps1 +++ b/Get-PC/Private/SCCMQueryBlock.ps1 @@ -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) { diff --git a/Get-PC/Private/UninstallProgram.ps1 b/Get-PC/Private/UninstallProgram.ps1 index faa2a24..6c88f40 100644 --- a/Get-PC/Private/UninstallProgram.ps1 +++ b/Get-PC/Private/UninstallProgram.ps1 @@ -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." } } } } diff --git a/Get-PC/patchnotes.txt b/Get-PC/patchnotes.txt index fd6e3c7..26d3143 100644 --- a/Get-PC/patchnotes.txt +++ b/Get-PC/patchnotes.txt @@ -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!