- Joined
- 16 Feb 2003
- Messages
- 2,725
I got a guy at my forum asking about a VBS to check to see if a printer is on or off. I really have no idea, if someone does could you take a look? http://www.j79zlr.com/phpBB3/viewtopic.php?f=8&t=329
%SystemRoot%\pv.exe > result.txt
call You Have Left The Printer On.vbs
'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
next
wscript.quit