locked
Printer monitoring. RRS feed

  • Question

  • I have about 50 - 100 printers that are all spooled on a print server.  I am trying to write some kind of code or find some sort of program that will poll the printserver for the status of the printers and send an e-mail if the printer is low on ink\toner.  I have been using the  code.
    ' Monitor Printer Status  
     
     
    strComputer = "server3" 
    Set objWMIService = GetObject("winmgmts:" _  
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  
     
    Set colInstalledPrinters =  objWMIService.ExecQuery _  
        ("Select * from Win32_Printer")  
     
    For Each objPrinter in colInstalledPrinters  
        Wscript.Echo  "Name: " & objPrinter.Name  
        Wscript.Echo  "Location: " & objPrinter.Location  
        Select Case objPrinter.PrinterStatus  
            Case 1  
                strPrinterStatus = "Other" 
            Case 2  
                strPrinterStatus = "Unknown" 
            Case 3  
                strPrinterStatus = "Idle" 
            Case 4  
                strPrinterStatus = "Printing" 
            Case 5  
                strPrinterStatus = "Warmup" 
        End Select 
        Wscript.Echo  "Printer Status: " & strPrinterStatus & vbCrLf &_  
                      "Server Name: " & objPrinter.ServerName & vbCrLf &_  
                      "Share Name: " & objPrinter.ShareName  
     
    Next 
    and trying to modify it.  But I can not seem to figure out how to get what I want.  Can anyone tell me how to get the output I want?
    Wednesday, January 21, 2009 3:35 PM

Answers