Check Printer Status with

Good Morning. Nothing exciting last night. I am ok with that. I’ve had WAY too much excitement as of late.

What we need to do is check if the printer is offline or online prior to printing.

Make it a great day!

Imports System
Imports System.Management
    Class PrinterOffline
        <STAThread()> _
        Private Shared Sub Main(ByVal args As String())
            ‘ Set management scope
            Dim scope As New ManagementScope("\root\cimv2")
            ‘ Select Printers from WMI Object Collections
            Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_Printer")
            Dim printerName As String = ""
            For Each printer As ManagementObject In searcher.[Get]()
                printerName = printer("Name").ToString().ToLower()
                If printerName.Equals("hp deskjet 930c") Then
                    Console.WriteLine("Printer = " + printer("Name"))
                    If printer("WorkOffline").ToString().ToLower().Equals("true") Then
                        ‘ printer is offline by user
                        Console.WriteLine("Your Plug-N-Play printer is not connected.")
                        ‘ printer is not offline
                        Console.WriteLine("Your Plug-N-Play printer is connected.")
                    End If
                End If
        End Sub
    End Class


  1. #1 by Thanks on September 25, 2012 - 11:06 am

    Exactly what I was looking for. Thank you.

  2. #2 by Marc Gurt on January 29, 2015 - 1:47 am

    It work’s! Thanks for the job 😉

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: