The following code will allow you to talk to a printer (running on a specific IP Address) to query its current status.
OLEPRNLib is a COM object that appears to be installed on XP and greater machines.
On my machine I made a reference on the COM tab of the Add Reference dialog to “oleprn 1.0 Type Library“ which lived in “c:\Windows\System32\oleprn.dll“
using System;
using OLEPRNLib;
namespace PrinterStatus
{
///
Comments
# re: C# Sample code to talk to a printer using SNMP to get its status.

I have been talked to a print by this code.
But I couldn't talk to Zebra Barcode Printer ( 140 Xi III Plus Model ).
I catched Ready Status and Out of Paper Error, but another status, for example, Printing(Running) and OffLine(Pause) status.
How can I know these status?
# re: C# Sample code to talk to a printer using SNMP to get its status.

is there any other code like this. if so can me provide the link so that i can know more about SNMP and try to handle/get status information the devices from remote location
# re: C# Sample code to talk to a printer using SNMP to get its status.
There are common OID SNMP identifiers and the ones I was using in the article
The full OID for hrPrinterDetectedErrorState
.iso.org.dod.internet.mgmt.mib-2.host.hrDevice.hrPrinterTable.hrPrinterEntry.hrPrinterDetectedErrorState
or simply .1.3.6.1.2.1.25.3.5.1.2
This object represents any error conditions detected by the printer. The error conditions are encoded as bits in an octet string, with the following
definitions:
Condition Bit #
lowPaper 0
noPaper 1
lowToner 2
noToner 3
doorOpen 4
jammed 5
offline 6
serviceRequested 7
inputTrayMissing 8
outputTrayMissing 9
markerSupplyMissing 10
outputNearFull 11
outputFull 12
inputTrayEmpty 13
overduePreventMaint 14
Bits are numbered starting with the most significant bit of the first byte being bit 0, the least significant bit of the first byte being bit 7, the
most significant bit of the second byte being bit 8, and so on. A one bit encodes that the condition was detected, while a zero bit encodes that the condition was not detected.
This object is useful for alerting an operator to specific warning or error conditions that may occur, especially those requiring human intervention.
The best way to see what is around is to look at a MIB Browser
http://www.ireasoning.com/mibbrowser.shtml
If you download the tool above there is a free version and you would then load the Printer-MIB.MIB to get information like above.
# re: C# Sample code to talk to a printer using SNMP to get its status.

# re: C# Sample code to talk to a printer using SNMP to get its status.
Can anybody can guide me how can i get all the printer names which are all attached in a Network ?
# re: C# Sample code to talk to a printer using SNMP to get its status.

seems to me as if you forgot to
snmp.close();
after querying.
# re: C# Sample code to talk to a printer using SNMP to get its status.

I need to know whether the printer(dymo label printer) status active or not which was installed on the network (192.168.1.18\dymolabel shared) from the other machine.
the above example doesent work for me as i cant get the OID for the dymo label printer.
Can any one help me how to do the above requirement please
# re: C# Sample code to talk to a printer using SNMP to get its status.

uint WarningErrorBits = snmp.GetAsByte(String.Format("25.3.5.1.2.{0}", DeviceID));
I am getting error "HRESULT E_FAIL has returned from a call to a COM component"
Can any one help me why I am getting the error!!
# re: C# Sample code to talk to a printer using SNMP to get its status.

I just got this one too and when pinged it the printer was down.
Make sure the printer is up.
# re: java Sample code to talk to a printer using SNMP to get its status.

# re: C# Sample code to talk to a printer using SNMP to get its status.

can anybody guide me to write the code in C# to access the of various node status in LAN using SNMP protocol.If any one is interested please mail me.
# re: C# Sample code to talk to a printer using SNMP to get its status.
1. whether Printer is Printing or not,
2. whether it is on Or off,
3.how many copies printed.
Can u help me
# re: C# Sample code to talk to a printer using SNMP to get its status.

Is it possible to use snmp on network to get informations (counter) from shared printers ?
# re: C# Sample code to talk to a printer using SNMP to get its status.
# re: C# Sample code to talk to a printer using SNMP to get its status.
# re: C# Sample code to talk to a printer using SNMP to get its status.

for a network printer i send an smtp request to the printer's IP with oid : 1.3.6.1.2.1.43.10.2.1.4.1.1
but for a shared printer i have to send it to the computer?