diff --git a/Get-PC/Private/SHSPrinter.ps1 b/Get-PC/Private/SHSPrinter.ps1 index d659748..fdb2d0f 100644 --- a/Get-PC/Private/SHSPrinter.ps1 +++ b/Get-PC/Private/SHSPrinter.ps1 @@ -196,32 +196,30 @@ $Headers = @{ Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for MAC address' -PercentComplete 50 -ParentId 2 try { $MAC = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.10.2.1.5.2').toupper() } catch { $MAC = $null } Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for serial number' -PercentComplete 70 -ParentId 2 - try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null } + try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.1.9.0') } catch { $serial = $null } + if (!$serial) { try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null } } # try { $status = $snmp.Get('.1.3.6.1.4.1.10642.200.4.1.0') } catch { $status = $null } - # Zebra GK420 Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode' -PercentComplete 80 -ParentId 2 - try { $ipconfig = "($($snmp.Get('.1.3.6.1.4.1.10642.200.50.1.1.5.0')))" } catch { $ipconfig = $null } - # Zebra ZD421 - if (!$ipconfig) { - Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode (2nd attempt)' -PercentComplete 85 -ParentId 2 - try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null } - $ipconfig = switch ($ipconfig) { - 1 {'(All)'} - 2 {'(GLEANING ONLY)'} - 3 {'(RARP)'} - 4 {'(BOOTP)'} - 5 {'(DHCP)'} - 6 {'(DHCP AND BOOTP)'} - 7 {'(PERMANENT)'} - } + try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null } + $ipconfig = switch ($ipconfig) { + 1 {'(All)'} + 2 {'(GLEANING ONLY)'} + 3 {'(RARP)'} + 4 {'(BOOTP)'} + 5 {'(DHCP)'} + 6 {'(DHCP AND BOOTP)'} + 7 {'(PERMANENT)'} + default {'(UNKNOWN)'} } $model = "Zebra $model" Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2 #STATUS - $uri = $domainName + $uri = "http://$printerip" $html = Invoke-WebRequest -uri $uri $raw = $html.rawcontent $raw -match '([A-Z])\w+<.F' | Out-Null + # Captures the first text between a > and < after "Status:" + #$raw -match 'Status:.*>(\w+)<.*>(\w+)<' | Out-Null $status = ($Matches[0] -split '<')[0] #split off error condition $raw -match 'RED>.+' | Out-Null diff --git a/Get-PC/patchnotes.txt b/Get-PC/patchnotes.txt index 534c58e..ab14d49 100644 --- a/Get-PC/patchnotes.txt +++ b/Get-PC/patchnotes.txt @@ -1,3 +1,7 @@ +Patch +-Fix Zebra printer statuses report correctly now +-Fix ZD421 printers report Serial numbers correctly + Patch 2025-5-28 -Update SCCMQueryBlock uses asset tag to query Spark! -Fix SCCM apps report version correctly