I am running on 2023.3.1 Solarwinds platform and I have a print server. Need to monitor the printer status and send an alert when the status of the printer goes to paused state.
Thanks
Indu
Hi,
I got below powershell script to get the paused printer status, and I am using this under Windows Powershell component. while checking the output its returning the right output however the output result shows as Get output failed error as highlighted in below screenshot.
Can someone help me to get the proper output and get the component down/warning when any printer goes paused state.
@KMSigma.SWI Hi, Is it possible for you to have a look on my query above and help. Any suggestions will be much appreciated. Thanks.
@Indumathi.E
So I would say definitly test something like this out. Every environment is different so I can't gurantee it will work.
Monitor Offline Printers
Using the latest code block I uploaded in the other one. You would just need to add in the Paused count, and build out the switch statement. So it would probably need:
$PrinterPaused = $Printers | Where-OBject {$_.PrinterStatus -eq "Paused"} $PrinterPausedCount = ($PrinterPaused | Measure-Object).Count
So full code with various status would be something like:
$PrinterNotNormal = $Printers | Where-Object {$_.PrinterStatus -ne "Normal"} $PrinterNotNormalCount = ($PrinterNotNormal | Measure-Object).count $PrinterNormal = $Printers | Where-OBject {$_.PrinterStatus -eq "Normal"} $PrinterNormalCount = ($PrinterNormal | Measure-Object).count $PrinterPaused = $Printers | Where-OBject {$_.PrinterStatus -eq "Paused"} $PrinterPausedCount = ($PrinterPaused | 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 ";")" } }#Paused Write-Host "Statistic.Paused: $($PrinterPausedCount)" Switch ($PrinterOfflineCount) { {$_ -eq 0} {Write-Host "Message.Paused: No printers with Paused Status" } {$_ -gt 0} {Write-Host "Message.Paused: $(($PrinterPaused.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