Print Queue Status Monitor with Email

I have a brand new Windows Server 2012 R2 Datacenter virtual server that is setup as a print server.  I saw the custom filters in the Print Management console but found out that notifications only work with that console open.  Since I'm not logged
into that machine all the time, I need a powershell script that can do what the custom filters do in the Print Management console.  Here's what I'm looking for:
1. When the print server starts the script starts.  This script should always stay active.
2. The script polls the print queues for a change in status to anything other than Ready every 5 minutes or so.
3. If the printer name contains "CC2", then email certain people the status of that particular printer.  Only email them once so as to not spam them with constant emails (maybe 1 email per day per status change).
So basically I'm looking to email my customer service department if one of their printers goes to a status of anything other than Ready.  Is something like this possible with Powershell?

My scripts compares the customer service printers (printer names starting with CC2) status every 5 minutes.  If the status has changed and there are Offline printers then customer service gets an email.  I'm using Task Scheduler to start the script
at 6:00am every day and the script will quit around 11:00pm.  It's not very elegant but it will get the job done.  Thanks for all your help!
# Time limit when the script expires
$Limit = (Get-Date).AddDays(1)
$SleepSeconds = 300
$PreviousStatus = @()
while ((Get-Date) -lt $Limit)
$CurrentStatus = Get-Printer -computername SERVER | Where {($_.PrinterStatus -ne "Normal") -and ($_.Name -Match "CC2")} | Select Name,PrinterStatus
if ($CurrentStatus)
if (Compare-Object $CurrentStatus $PreviousStatus -property Name,PrinterStatus)
# Establish Connection to SMTP server
$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$a = $a + "</style>"
$filedate = get-date
$smtpserver = “smtp.gmail.com”
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer )
$smtp.EnableSsl = $True
$smtp.Credentials = New-Object System.Net.NetworkCredential(“[email protected]”, “password”); # Put username without the @GMAIL.com or – @gmail.com
$msg.IsBodyHtml = $True
$msg.From = “[email protected]
$msg.To.Add(”[email protected]”)
$msg.To.Add(”[email protected]”)
$msg.To.Add(”[email protected]”)
$msg.To.Add(”[email protected]”)
$msg.To.Add("[email protected]")
$msg.Subject = "Printer Status Errors $($filedate)"
$msg.Body = Write-Output -InputObject (Get-Printer -computername SERVER | Where {($_.PrinterStatus -ne "Normal") -and ($_.Name -Match "CC2")} | Select Name,PrinterStatus,Comment,Location,Portname) | ConvertTo-Html -Head $a
$smtp.Send($msg)
$PreviousStatus = $CurrentStatus
Start-Sleep -Seconds $SleepSeconds
if ((get-date).Hour -eq 23) {Exit}

Similar Messages

  • Server Admin doesn't show Print Queue status

    When I look at my print queues (all 17) under Server Admin, it shows queue name, # of jobs, shared via (IPP & SMB), and printer kind (HP LJ 1022n and HP LJ P2015). It has a column for status, but this is always 100% empty/blank. Also, if I go to the Jobs tab, then I can pick "Jobs on Queue" for all the queues, but the line below for "Queue Status" is again always blank.
    Is there something I can do to get this info to show up in Server Admin? I know that CUPS knows the printer status, as I can go to localhost:631 and see the status in the Printers list and the Jobs list.
    It isn't life threatening. It is just annoying to have to go to the web page when Server Admin -almost- gets me everything I need to diagnose a teacher's printing problem remotely.

    Hi Keith
    You could always consult the Print Service logs. If you set the logging levels to Debug or Debug2 you should get everything. You have to be a bit careful with this as the log can get quite large. Other than that I don’t know of anything that is available out of the box.
    There may be others that can suggest a 3rd party solution that gives you the appropriate feedback you are looking for. Opening port 631 should not be that much of risk I would have thought?
    Tony

  • Why is my HP Deskjet 970C  Print Queue Status  "Stopped" and won't change?

    I recently installed 10.5 Leopard. Hooked up my old HP-970C Deskjet. Used the link: http://www.linuxfoundation.org/en/OpenPrinting/MacOSX/foomatic to get the new HP Driver as recommended. Set up printer with this driver.
    Each time the print command is given (Word Doc or .pdf file) nothing happens. The job is shown in the Print Queue with the Status says "Stopped." Clicking the resume button does not start the printer. Twice more and I get a message that says "Operation Could not be completed. client-error-not-possible."
    Any thoughts on how to work around this?
    Tried the six steps listed at: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01462601&lc=en&dlc=en&cc=us &lang=en&softwareitem=bi-54970-4&os=219&rule=5837&product=3435684
    Even those great steps did not help. Any other ideas? Thanks!!!

    The short answer is that you have an older HP printer, and have just been bitten by HP's abandonment of older printers on both Leopard and Vista.
    The foomatic drivers should work, though; I used foomatic drivers on my old HP MFD for years. They gave better output than the ones HP shipped, and actually worked in Leopard. I put the HP onto a machine running XP because scanning didn't work anymore on either Vista or Leopard and HP had no intention of fixing it.
    When I see the error you quoted, there are usually three possible causes:
    1 the printer itself has a hardware problem. The fix for that is to buy a new printer, it's not economic to repair a DJ970.
    2 the HP drivers are present on the system and are interfering. The fix for that is to remove the HP drivers and just have the foomatic drivers installed.
    3 the USB cable is bad or loose. The fix for that is to get a new USB cable and make sure that it is securely plugged in.

  • Re-map print queues for clients with powershell

    We reinstalled printer queues (share printer name is the same as before) and drivers on server, 99% users can't print properly, is a way to re-map print queues for all clients with PowerShell equivalent to remove and map again?

    Hi Brent,
    To re-map all of the printers, please check this script written by Boe Prox:
    <#
    .SYNOPSIS
    Logon Script to migrate printer mapping
    .DESCRIPTION
    Logon Script to migrate printer mappings
    .NOTES
    Author: Boe Prox
    Create: 09 NOV 2012
    Modified:
    Version 1.0 - Initial Script Creation
    1.1 Added Header Text for CSV file
    #>
    Param (
    $newPrintServer = "Server2",
    $PrinterLog = "\\LogSVR\PrintMigration$\PrintMigration.csv"
    <#
    #Header for CSV log file:
    "COMPUTERNAME,USERNAME,PRINTERNAME,RETURNCODE-ERRORMESSAGE,DATETIME,STATUS" |
    Out-File -FilePath $PrinterLog -Encoding ASCII
    #>
    Try {
    Write-Verbose ("{0}: Checking for printers mapped to old print server" -f $Env:USERNAME)
    $printers = @(Get-WmiObject -Class Win32_Printer -Filter "SystemName='\\\\Server1'" -ErrorAction Stop)
    If ($printers.count -gt 0) {
    ForEach ($printer in $printers) {
    Write-Verbose ("{0}: Replacing with new print server name: {1}" -f $Printer.Name,$newPrintServer)
    $newPrinter = $printer.Name -replace "Server1",$newPrintServer
    $returnValue = ([wmiclass]"Win32_Printer").AddPrinterConnection($newPrinter).ReturnValue
    If ($returnValue -eq 0) {
    "{0},{1},{2},{3},{4},{5}" -f $Env:COMPUTERNAME,
    $env:USERNAME,
    $newPrinter,
    $returnValue,
    (Get-Date),
    "Added Printer" | Out-File -FilePath $PrinterLog -Append -Encoding ASCII
    Write-Verbose ("{0}: Removing" -f $printer.name)
    $printer.Delete()
    "{0},{1},{2},{3},{4},{5}" -f $Env:COMPUTERNAME,
    $env:USERNAME,
    $printer.Name,
    $returnValue,
    (Get-Date),
    "Removed Printer" | Out-File -FilePath $PrinterLog -Append -Encoding ASCII
    } Else {
    Write-Verbose ("{0} returned error code: {1}" -f $newPrinter,$returnValue) -Verbose
    "{0},{1},{2},{3},{4},{5}" -f $Env:COMPUTERNAME,
    $env:USERNAME,
    $newPrinter,
    $returnValue,
    (Get-Date),
    "Error Adding Printer" | Out-File -FilePath $PrinterLog -Append -Encoding ASCII
    } Catch {
    "{0},{1},{2},{3},{4},{5}" -f $Env:COMPUTERNAME,
    $env:USERNAME,
    "WMIERROR",
    $_.Exception.Message,
    (Get-Date),
    "Error Querying Printers" | Out-File -FilePath $PrinterLog -Append -Encoding ASCII
    Quote from:
    Use a PowerShell Logon Script To Update Printer Mappings
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • OSB Monitoring with email alerts

    Hi All,
    I am using OSB to virtualize a business service. The service basically receives feed from external party using one-way messaging pattern. I want to raise an alert at the OSB proxy layer if I do not receive any message from the third party for the last five minutes. How to go about it.
    Thanks

    Hello,
    You need to configure the SLA alert rule in the proxy which receives the message from third party. Alert rule should be based on message count. If you have a running OSB instance then go to the proxy service --> SLA Alert Rules tab, click on Add button (you need to start edit session), provide the values on the General configuration page and click next to go to Alert Rules Conditions Configuration page, and in simple expression fill -
    Count - Message Count - < 1
    Click on add. In Aggregation Interval, select the value 5 mins.
    Go to the last and save and you are good to go.
    Regards,
    Anuj

  • Monitor print queue for job size

    Hi,
    Problem: Occasionally, some print queues are found with a job that is spooling uncontrolled. Job will reach 2/3GB which will cause services to under perform and sometimes crash.
    We are looking at understanding the reason why the file is spooling uncontrolled. I believe it is something to do with the fact some of the users are roaming users and when moving site, when arriving to a new site they should get the correct printers for
    that site. It is happening that this is not being applied so they print to the printer on the previous site where they were, which seems to cause this behavior.... anyway.. I do not have any more logic details around this.. still exploring..
    The question today is, can I set some sort of monitoring on the local print server to alert me when a job on any print queue has reached a specific size?
    Or perhaps delete the job automatically if it does reach this threshold.
    Thank you

    On Server 2012 use the powershell commands included with the product.  For 2008R2 and prior use the WMI Interfaces and the scripts included with the OS
    prnjobs.vbs to list job size and ID, then when the size is excessive the same script is used to delete the job.
    This information at the scripting center looks like what you wish to accomplish
    https://gallery.technet.microsoft.com/scriptcenter/9b07ec17-a3ae-427d-a417-c95f05fc515f
    Alan Morris formerly with Windows Printing Team

  • Print Job visibility on shared print queues

    Hello all,
    Quick scenario, where print server has a print queue shared with several clients. Each user is sending jobs using this shared queue. Is it possible that users only see their print jobs when opening the print queue, instead of all jobs, from other users,
    being sent to that print queue.
    I am aware that you can mask the job title and job owner, from the driver prespective. Nevertheless I am wondering if there is something from a service or policy prespective that can be applied globally to all printer, independely of the print driver in
    use.
    Thanks

    Yes.   The client will not matter.  The driver version or Type will not matter.
    The documentation is extremely limited.  Most of the 2012 What's new in..... was overwritten with the What's new in 2012R2.
    But what the heck.  I always go the extra mile for people wishing to deploy print servers.   There has been a patch release where you can add the true document name in the print event logged.  There are ways to determine the queue view
    true document name but code would need to be written and compiled.
    https://technet.microsoft.com/en-us/library/jj134163.aspx
    When printing to a Windows Server 2012 print queue, only users with administrator permissions on the print queue (full system administrator or delegated print administrator, see
    Assign Delegated Print Administrator and Printer Permission Settings in Windows Server 2012) will see readable document names when viewing the print queue.  Users can still view the
    queue from their client computer and will see their own document name in full, but for other user’s print jobs they will see
    Print Document for the document name.
    Additionally, in most cases in the event log on the server, the document name will also appear as
    Print Document.  However, in some job failure cases, the document name will be listed in the failure event.
    Alan Morris formerly with Windows Printing Team

  • CP1515n, prints a status after every print job"Host IP & GET/DevMgm​t/Discover​yTree.xml HTTP/1.1"

    Hi,
        I have a HP color laserjet CP1515n. Whenever I give it a print job it prints a status page with two lines only like this
    "GET/DevMgmt/DiscoveryTree/.xml HTTP/1.1
     Host: 127.0.0.1:8080"
       I tried to disable this but I am not able to do so kindly please help as it is using paper and ink at the same time.
    Thanking in advance
    Naeem
    This question was solved.
    View Solution.

    Hello Mna,
    Thanks for the post.  With this error message, I was able to locate a previous thread that addresses this issue.  I've included that link below.   Good Luck!
    Thanks Mr.Mojo for the information!!
    http://h30434.www3.hp.com/t5/Printer-All-in-One-In​stall-Setup/Unwanted-pages-printing-with-quot-GET-​...
    I worked for HP but my posts and replies are my own....Thank you!
    *Say thanks by clicking the *Kudos!* which is on the left*
    *Make it easier for other people to find solutions, by marking my answer with (Accept as Solution) if it solves your issue.*

  • Monitor Print Queue with java program

    I'm plan to write a client/server based application which control the printing for every user. I've no idea how to start on the application.
    1. Is it possible to monitor the print queue or print job using java application?
    2. How does the server react if the client sending the print job to there? How's the client can trigger the signal during printing and send to the server?
    Thank you!

    I'm plan to write a client/server based application
    which control the printing for every user. I've no
    idea how to start on the application.You should establish feasibility first, before planning to write anything
    1. Is it possible to monitor the print queue or print
    job using java application?Not really. Print queues are highly system-dependent things and some e.g. Windows can really only be accessed via system calls in a native language.
    2. How does the server react if the client sending
    the print job to there?Err, it prints the file?
    How's the client can trigger the signal during printing and send to the server? What signal?
    But I suspect the answer to the first question makes the others irrelevant.

  • Monitor SQL Server service Broker queue status

    I need to monitor SQL Server service Broker queue status.  If the queue is disabled, send me an email alert.
    Can you let me know what's the best way to accomplish it using SCOM?

    1) create a queue for notification
    2) create a service on notification queue
    3)Create an event notification for broker queue disable. Associate this with the queue that you are monitoring.
    4)Create a procedure that send you and email with this event happens
    Example:
    ---- Notification
    CREATE
    QUEUENotify_queue
    -- Service
    CREATE
    SERVICE[http://queue_Notify]
    ONQUEUENotify_queue([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]);
    --Event 
    CREATE
    EVENTNOTIFICATION[http://queue_Notify_event]
    ONQUEUETarget_queue
    FORBROKER_QUEUE_DISABLED
    TOSERVICE'http://queue_Notify','current
    database';
    GO
    procedure will be something like...
    WAITFOR
    RECEIVETOP(1)
    @RecvReqMsgName=message_type_name,
    @RecvReplyMsg=message_body,
    @RecvReplyDlgHandle=conversation_handle
    FROMNotify_queue),TIMEOUT5000
    IF(@RecvReqMsgName='http://schemas.microsoft.com/SQL/Notifications/EventNotification')
    BEGIN
    DECLARE@cmdNVARCHAR(MAX)
    SET@cmd='dbo.sp_send_dbmail
    @profile_name="Name XYZ",
    @recipients="[email protected]",
    @body="CAST(@RecvReplyMsg as NVARCHAR(MAX)",
    @subject="Queue Disabled Detected";'
    EXEC
    (@cmd)
    END

  • Alien communique​, print queue lagging, printer refuses to e-print, can't find with laptop

    I purchased the HP Photosmart Plus e-All-in-One Printer - Black (CN216A#B1H) to replace my top-feed printer whose ink was disappearing from retail stores. It is connected to my Mac Mini (OS: leopard 10.5) via USB, and to my home wifi network. I have a pc (OS: XP) laptop that also connects to the internet via wifi network. Here are my problems:
    1. The printer refuses to e-print. I have it set up with hpeprint, and it'll connect to hpeprint occasionally, usually after rebooting. I can print using the apps on the printer, but I can't email ANYTHING to it. I've even spent an hour on the phone with HP's help center, and he's sent stuff to the printer that never printed. It doesn't matter how it's sent--attachment or in the email--or what it is, it just sits in the queue until it fails. I paid more for this feature----why won't it work??
    2. I can't find the printer with the laptop. Now this may be my ineptitude with windows, but even my husband (whose laptop it is) can't figure it out. I can access the printer's url in a browser (http://192.168....you know), but I can't get the Add A Printer wizard to recognize the printer. It wants to go in through shared computers, looking for a printer on my Mini--which, by the way, for some strange reason my router won't let computers on my network access my hard-wired mini. Anyways, that's a headache for another day.
    3. Last night I tried to print a copy of a legal form, and the job sat in the computer's print queue for about an hour before the printer finally started warming up to print. Then it only printed the first half of the first page, spat it out, and gave me (after about half an hour more) a half dozen pages that look like some kind of alien communique. I've actually had it do this to me a couple times in the last day, just randomly printing these pages until I cancel print. Whatthe?
    Setup seemed to be remarkably easy. I just plugged the thing in and followed the prompts. But now I'm starting to have buyer's remorse. What in the world is wrong with this printer?? If you can help me clear up one or two of these things, I'd greatly appreciate it, since it means less time I'll be on the phone with Customer Service.

    By the way, here's what it printed:

  • How to monitor , troublesheet SAP Print queues at O/S level (i.e.UNIX, AIX)

    Hi All,
    In our environment most of the time there is no problem of printing from sap side but from o/s level there are problem and we don't have direct access to o/s. Basis and server admin team from other vendor solved the problem.
    But , i need to know is there any document/notes available to monitor and trobleshoot  SAP print queues at o/s level? Request you to advice how i can do that?
    Thanks

    But, many times they say that the print request are stuck in the queue. If this is the case how we going to resolve the problem? Shall we reset the print queue ? How?
    You will need to re-enable the queue, again you can write a simple program to use command enable <printer> queue. But at the end of the day if you don't hold administration rights for the OS you need to rely on your "server admin team" to solve the issues with the print server.
    This is part of why is important for IT and SAP team to be aligned.
    Regards
    Juan

  • Using eprint to print photos with email text on one page

    I have been using Presto eprint services for several years for my Dad, and I really like how it works and allows me to print the email (from, to, text in the body of the email), plus any attachments, all on one page using full letter size paper  However, my parents would like to get rid of their land-line phone, so I'm looking for options to replace the Presto printer.  I was thinking that HP eprint might be a good option, but based on some initial tests with a friends printer, it seems to just print photos as full page images, without the email content.  Is there anyway to confirgure the HP eprint function to print the email text and photos or PDF file attachment on one page?  Thanks.

    Hello @Joseph_TX ,
    Welcome to the HP forums.
    I understand that you want to know if a way to configure the HP ePrint.
    I would like to help.
    Unfortunately there is no way to reconfigure the ePrint.
    When you send an email to the printers ePrint address, it will print the body of the email and any attachments.
    It will not print the subject line or who the email is from.
    Also the ePrint feature will not resize pictures sent.
    What you send is what you get.
    You can get more control over ePrint with the ePrint app, but I don't believe that will suit your needs.
    Please call our Cloud Services at 855-785-2777.
    If you live outside the US/Canada Region, please click the link below to get the support number for your region. http://www8.hp.com/us/en/contact-hp/ww-phone-assist.html
    Hours:
    Mon-Fri. 8am - 11pm, Sat. 9am-8pm - EST
    Mon-Fri. 7am - 10pm, Sat. 8am-7pm - CST
    Mon-Fri. 6am - 9pm, Sat. 7am-6pm - MST
    Mon-Fri. 5am - 8pm, Sat. 6am-5pm - PST
    Aardvark1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!

  • I have set up my airprint wifi printer which works perfectly with the HP eprint app. However, when i view an email and click on the top right arrow button and select "PRINT" on my ipad nothing happens????...

    I have set up my airprint wifi printer which works perfectly with the HP eprint app. However, when i view an email and click on the top right arrow button and select "PRINT" on my ipad nothing happens????...
    Also, when im viewing websites and i find something i wish to print, same again, if i simply click on the print option at the top right of the screen nothing happens... the only way I can print is if i copy the weblink of the site page then click on my HP eprint app and paste the web link, then select print, it prints off fine.. but its it such a pain to keep copying and pasting links or screen dumping emails just to print...

    Just to recap, this is a collection of ports I have collected over time for people who needed this information when setting up the HP ePrint app so that they could view their email from within the app.  I am certain other applications also need this information.  Although lengthy, I could not find a more comprehensive place to retrieve this information.  Feel free to post additional information, faulty information, or other related topics below as this is simply a collection of data and it would be practically impossible to test all of them. Thank you!
    Don't forgot to say thanks by giving "Kudos" if I helped solve your problem.
    When a solution is found please mark the post that solves your issue.
    Every problem has a solution!

  • HT4356 I'm using my iPod and an Epson XP-810 printer to print pages from websites and emails and etc.  How do I print just 1 page out of 14 pages .  I don't see any settings on my iPod and can't find settings on the printer .   Can someone help with this

    I'm using my iPod and an Epson XP-810 printer to print pages from websites and emails and etc. 
    How do I print just 1 page out of 14 pages . 
    I don't see any settings on my iPod and can't find settings on the printer .  
    Can someone help with this problem

    Google show that you have to cut what you want to print and then paste it into a new app and print from that app.
    http://www.ipadforums.net/new-member-introductions-site-assistance/63145-printin g-one-page-ipad-2-a.html

Maybe you are looking for