VBS script to check printer status


Woah.. I'm still here?
Political Access
26 Apr 2004
i'm still not quite sure what he's trying to do.. his batch file "example" makes no sense..

what is this doing?
%SystemRoot%\pv.exe > result.txt
and why use a vbscript file to just display a message?
call You Have Left The Printer On.vbs
What he says and what he is showing seem to be two different things..

Going by what he said, he could create a vbscript file to run as a shutdown script..

The template below will check the status of the printer and display a box with just an OK button telling him to shut off the printer.

If he were to, say, go into his local policies and add the script as a shutdown script, it should run.. not sure if/how the message box will display or not in the middle of a shutdown though.

objPrinter.PrinterStatus=3 is the "ready" printer state
strPrinter should be set to the name of the printer
strComputer really isn't necessary as it is just the local PC.. force of habit for me.
'run at shutdown to check the status of a printer

Option Explicit
Dim objWMI, objPrinter, colPrinters, strComputer,strPrinter,strWMIQuery

strComputer = "."
strPrinter = "Some Printer Name"
strWMIQuery = "SELECT * FROM Win32_Printer WHERE name=""" & strPrinter & """"

set objWMI = GetObject ("winmgmts:\\" & strComputer & "\root\CIMV2")

set colPrinters = objWMI.ExecQuery(strWMIQuery)

for each objPrinter in colPrinters
    if not(objPrinter.PrinterStatus=3) then
        msgbox "Turn off the Printer!",0,"Printer Is Still On!"
    end if

Last edited:


Glaanies script monkey
Political Access
16 Feb 2003
Thanks for looking at it. I really don't do any VBS so I would be wildly guessing.

Members online

No members online now.

Latest profile posts

hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!

Forum statistics

Latest member