Jump to content

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.

Link to comment
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"
    EndSwitch
    ConsoleWrite ( "-->-- Printer Status : " & $_strPrinterStatus & @Crlf )
    ConsoleWrite ( "-->-- Server Name : " & $_objPrinter.ServerName & @Crlf )
    ConsoleWrite ( "-->-- Share Name : " & $_objPrinter.ShareName & @Crlf )
Next

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...