473,780 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printer Status over Network

Hello all,

Please help and suggest the code to get the printer status over the
network.
for Example, i have an string "\\\\os1\\PtNam e"

where os1 is the system name
and PtName is the printer name

I need to know the status of this printer on the system name "os1".
Please suggest me the code for that in C#.

I am using WMI but not able to get anything helpful stuff.
Thank's and Regards
Tarun Sinha

Jul 31 '07 #1
2 4241
Tarun,

What is the query you are using in WMI? Is the printer available from
the local machine, or no? If it is not, then I don't think you can get the
printer information (the WMI providers work on the local machine). I think
you would have to connect to the WMI provider on "os1" and then run the
query there.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"TARUN" <ta*********@gm ail.comwrote in message
news:11******** **************@ d30g2000prg.goo glegroups.com.. .
Hello all,

Please help and suggest the code to get the printer status over the
network.
for Example, i have an string "\\\\os1\\PtNam e"

where os1 is the system name
and PtName is the printer name

I need to know the status of this printer on the system name "os1".
Please suggest me the code for that in C#.

I am using WMI but not able to get anything helpful stuff.
Thank's and Regards
Tarun Sinha
Aug 1 '07 #2
Thank's for reply

Yes i am able get the local machine printer information with the help
of WMI,
and here is the code :
ManagementScope mgmtscope = new ManagementScope (@"\root
\cimv2");
mgmtscope.Conne ct();
ManagementObjec tSearcher objSearcher = new
ManagementObjec tSearcher("Sele ct * from Win32_Printer") ;
foreach (ManagementObje ct printer in objSearcher.Get ())
{
sysName =
printer["SystemName "].ToString().ToL ower();
printerName =
printer["Name"].ToString().ToL ower();
}
I also tried
select * from win32_printer where servername = '\\os1'
but still not able to get the printer info on system name os1.
any idea ???
waiting for your reply ............... ...............

Thank's
Tarun sinha

On Aug 1, 8:08 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Tarun,

What is the query you are using in WMI? Is the printer available from
the local machine, or no? If it is not, then I don't think you can get the
printer information (the WMI providers work on the local machine). I think
you would have to connect to the WMI provider on "os1" and then run the
query there.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om

"TARUN" <tarun.si...@gm ail.comwrote in message

news:11******** **************@ d30g2000prg.goo glegroups.com.. .
Hello all,
Please help and suggest the code to get the printer status over the
network.
for Example, i have an string "\\\\os1\\PtNam e"
where os1 is the system name
and PtName is the printer name
I need to know the status of this printer on the system name "os1".
Please suggest me the code for that in C#.
I am using WMI but not able to get anything helpful stuff.
Thank's and Regards
Tarun Sinha- Hide quoted text -

- Show quoted text -

Aug 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6250
by: s_muneer | last post by:
Hi, I just type coding for retrieve printer status whether it’s out of paper, jammed, busy etc. But it cannot run properly. Anyone who has idea on how to retrieve status of network printer hopefully can help me find the solution. Thnx
7
4300
by: Jim Warner | last post by:
I am having problems using Borland 5.02 C/C++ for testing printer status repeatly. I wish to use my printer to detect off-line, removing paper, and so on with my software. I have tried using bio_print, bios_printer, and bio_serialcom but my program cannot detect it. I am using Windows XP and I have read that these functions can't be used since Windows 98 operating system will not support the functions. Can you help show a simple program...
5
19773
by: Ken | last post by:
Hello Everyone, I think that there is no way to add a network printer in .Net. I have tried ,as an alternative, using windows API AddPrinter. This was not successful. Does anybody have a possible solution in .NET? Thank You in Advance for Your Help, Ken
3
10066
by: Gordon Truslove | last post by:
I've been trying to get the printer status using GetPrinter and Printer_Info_2 I'm getting closer, but it still fails. Error 122 - The data area passed to a system call is too small. --------------------------------------------------------------- public struct PRINTERINFO2
1
18187
by: Vanessa | last post by:
Hi, I'm trying to select a printer in the system printers collection. I'm able to do this. However, if the printer is a network printer and happens that this printer is not on or not ready, I won't be able to know and I try to print a document I will get an error. Is there anyway that I can check the status for the printer that the user select is ready or not?
2
7126
by: up3umrmuofnz3pd | last post by:
Hi guys, I'm working on a small desktop publishing software project where I need to display the default printer's ink status/level in the status bar of the main form. For the past 2 days I've been trying to find a way of getting the printer ink level from the printer but I haven't been able to find something that's generic. I looked at the: * PJLMON.dll - PJL language commands for parrallel port or USB printers. Got stuck on the...
2
2536
by: =?iso-8859-1?Q?Vicente_Garc=EDa?= | last post by:
Hello all, I have an a bit strange printer and I would like to connect a C# program running on my computer to the printer. I know that the printer can be connected by LAN (TCP/IP protocol, 10/100 Base-T) but I am not quite sure of its meaning. I have not seen anything about that the printer could be connected by a specific port. Could someone please tell me if I can connect the computer to the printer via the Internet and how I could...
9
10349
by: id10t error | last post by:
Hello, I am going to be using a Symbol WT4090 to scan items. I need to printer a tag from the Zebra ql320 plus. I am trying to do this is Visual basic 2005. Does anyone know and good site to find out how to do this. I have looked everywhere i know with no luck. Thank you in advance for your help.
1
4226
by: Steve | last post by:
Hi All I am using vb.net 2005 in a windows forms application I send data to the selected windows printer using a PrintDocument object Is there any way to detect if the Printer is not responding e.g turned off, out of paper etc, via code I want to display a warning if the printer needs attention rather than just
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.