Jump to content
Sign in to follow this  

Check Shared Printer Status

Recommended Posts


Hi all,

I'd like to create a script that checks to see if a shared printer is available.

For example, in a computer class room, as each student turns on their computer, the script will run from startup folder and give the student a breif message about the printers status, if its turned ect.

any suggestions welcome.

Share this post

Link to post
Share on other sites

May be you'll be more lucky than me, this vbscript adaptation return always "idle" status, shared printer connected or not ! Posted Image

$_strComputer = @ComputerName ; "."
$_objWMIService = ObjGet ( "winmgmts:{impersonationLevel=impersonate}!\\" & $_strComputer & "\root\cimv2" )
$_colInstalledPrinters =  $_objWMIService.ExecQuery ( "Select * from Win32_Printer" )
For $_objPrinter in $_colInstalledPrinters
    ConsoleWrite ( "+->-- Name : " & $_objPrinter.Name & @Crlf )
    ConsoleWrite ( "+->-- Location : " & $_objPrinter.Location & @Crlf )
    Switch  $_objPrinter.PrinterStatus
        Case 1
            $_strPrinterStatus = "Other"
        Case 2
            $_strPrinterStatus = "Unknown"
        Case 3
            $_strPrinterStatus = "Idle"
        Case 4
            $_strPrinterStatus = "Printing"
        Case 5
            $_strPrinterStatus = "Warmup"
    ConsoleWrite ( "-->-- Printer Status : " & $_strPrinterStatus & @Crlf )
    ConsoleWrite ( "-->-- Server Name : " & $_objPrinter.ServerName & @Crlf )
    ConsoleWrite ( "-->-- Share Name : " & $_objPrinter.ShareName & @Crlf )

AutoIt X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.