Check to see if Print Services are Running on a Windows 2000 Server
Keywords: Print Services Windows 2000 server
Question:
Is it possible for winbatch to check to see if Print Services are running on a Windows 2000 server?
Answer:
It's easy using WinBatches COM Functions.
sAdsiPath = "WinNT://MYDOMAIN/MYSERVER/MyLaserPrinter"
oPrinter = ObjectOpen( sAdsiPath )
sStatus = oPrinter.Status
message("Laser Printer Status ", sStatus)
If sStatus is zero everything is ok. Here is a list of the other return values lifted from the c++ header files in the
SDK. They are in hex so you'll either have to fire up "Calculator" to do the conversions
or maybe use the xHex(hex-val) from the wilx extender:
ADS_PRINTER_PAUSED 0x00000001
ADS_PRINTER_PENDING_DELETION 0x00000002
ADS_PRINTER_ERROR 0x00000003
ADS_PRINTER_PAPER_JAM 0x00000004
ADS_PRINTER_PAPER_OUT 0x00000005
ADS_PRINTER_MANUAL_FEED 0x00000006
ADS_PRINTER_PAPER_PROBLEM 0x00000007
ADS_PRINTER_OFFLINE 0x00000008
ADS_PRINTER_IO_ACTIVE 0x00000100
ADS_PRINTER_BUSY 0x00000200
ADS_PRINTER_PRINTING 0x00000400
ADS_PRINTER_OUTPUT_BIN_FULL 0x00000800
ADS_PRINTER_NOT_AVAILABLE 0x00001000
ADS_PRINTER_WAITING 0x00002000
ADS_PRINTER_PROCESSING 0x00004000
ADS_PRINTER_INITIALIZING 0x00008000
ADS_PRINTER_WARMING_UP 0x00010000
ADS_PRINTER_TONER_LOW 0x00020000
ADS_PRINTER_NO_TONER 0x00040000
ADS_PRINTER_PAGE_PUNT 0x00080000
ADS_PRINTER_USER_INTERVENTION 0x00100000
ADS_PRINTER_OUT_OF_MEMORY 0x00200000
ADS_PRINTER_DOOR_OPEN 0x00400000
ADS_PRINTER_SERVER_UNKNOWN 0x00800000
ADS_PRINTER_POWER_SAVE 0x01000000
Article ID: W15031