Anyone have a good way of monitoring if a printer goes into an offline state and stays that way?
I use to monitor a handful of networked (IP Based) Dell printers a long time ago via SNMP. I found the OID's that correlated to 'ready' state and also found OID's to monitor the toner level. Set up a SAM template with SNMP monitors to track that. Every printer is different so you'd want to first see if the printer has SNMP available, and then research what OIDs can be used.
I should have added, is their a way to monitor on a Windows Server if it marks the Printer as Offline.
Thank you for that quick answer
SAM does have to ability to run a WMI query and/or a PowerShell monitor. You might also see if there is a Windows Event Log (eventID) generated for printer status. I don't have specific examples, but those are your best routes in SAM.
going off of what @chad.every said, SAM is probably your friend on this one.
I'm going to preface this with, I do not have a monitor like this in my environment at the moment and this is just kind of off the top of my head. In theory it should work, but may need some tweaks. You could get more specific on the PrinterStatus and return a count of printers in a normal state, Down state, etc... (not sure how many different states there are).
#Retrieves printers not in a normal state, reports down if cmdlet fails to runTry {$Printers = Get-Printer -ErrorAction Stop | Where-Object {$_.PrinterStatus -ne "Normal"}} Catch {Write-Host "Message: $($Error[0].Exception)"Write-Host "Statistic: $($Null)"Exit 1}$PrinterCount = ($Printers | Measure-Object).countWrite-Host "Statistic: $($PrinterCount)"If ($PrinterCount -eq 0) {Write-Host "Message: All printers in normal state"} Else {Write-Host "Message: $($Printers.Name -join "}Exit 0
Hi @SteveK
I tried the above script and I am getting noot defined error as in below SS. Any further suggestions pls.
I had a typoe in the join, the semicolon should have been in quotes.
I messed around a little bit and came up with the following. It did pass the SW test, but once against test it in your environment and modify as needed. I didn't have a full list of statuses, so you may have to add additional ones if you want to calculate for them specifically. Ideally you could probably get away with just displaying Not Normal, Total, Normal and Offline. It really depends on what you are specifically looking for.
#Retrieves printers, reports down if cmdlet fails to runTry {$Printers = Get-Printer -ErrorAction Stop} Catch {Write-Host "Message: $($Error[0].Exception)"Write-Host "Statistic: $($Null)"Exit 1}#Build out variables for script based off of Get-Printer $PrinterCount = ($Printers | Measure-Object).count $PrinterNotNormal = $Printers | Where-Object {$_.PrinterStatus -ne "Normal"} $PrinterNotNormalCount = ($PrinterNotNormal | Measure-Object).count $PrinterNormal = $Printers | Where-OBject {$_.PrinterStatus -eq "Normal"} $PrinterNormalCount = ($PrinterNormal | Measure-Object).count $PrinterOffline = $Printers | Where-OBject {$_.PrinterStatus -eq "Offline"} $PrinterOfflineCount = ($PrinterOffline | Measure-Object).count $PrinterDoorOpen = $Printers | Where-Object {$_.PrinterStatus -eq "DoorOpen"} $PrinterDoorOpenCount = ($PrinterDoorOpen | Measure-Object).count $PrinterToner = $Printers | Where-Object {$_.PrinterStatus -like '*Toner*'} $PrinterTonerCount = ($PrinterToner | Measure-Object).count#Not Normal Write-Host "Statistic.NotNormal: $($PrinterNotNormalCount)" Switch ($PrinterNotNormalCount) { {$_ -eq 0} {Write-Host "Message.NotNormal: No pritners with abnormal status" } {$_ -gt 0} {Write-Host "Message.NotNormal: $(($PrinterNotNormal.Name) -Join ";")" } }#Total Write-Host "Statistic.Total: $($PrinterCount)" Write-Host "Message.Total: $($PrinterCount) printers found"#Normal Write-Host "Statistic.Normal: $($PrinterNormalCount)" Write-Host "Message.Normal: Currently $($PrinterNormalCount) with Normal status"#Offline Write-Host "Statistic.Offline: $($PrinterOfflineCount)" Switch ($PrinterOfflineCount) { {$_ -eq 0} {Write-Host "Message.Offline: No printers with Offline Status" } {$_ -gt 0} {Write-Host "Message.Offline: $(($PrinterOffline.Name) -Join ";")" } }#Door Open Write-Host "Statistic.DoorOpen: $($PrinterDoorOpenCount)" Switch ($PrinterDoorOpenCount) { {$_ -eq 0} {Write-Host "Message.DoorOpen: No printers with DoorOpen Status" } {$_ -gt 0} {Write-Host "Message.DoorOpen: $(($PrinterDoorOpen.Name) -Join ";")" } }#Toner Write-Host "Statistic.Toner: $($PrinterTonerCount)" Switch ($PrinterTonerCount) { {$_ -eq 0} {Write-Host "Message.Toner: No printers with Toner Status" } {$_ -gt 0} {Write-Host "Message.Toner: $(($PrinterToner.Name) -Join ";")" } }Exit 0