473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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\\PtName"

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 4211
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.com

"TARUN" <ta*********@gmail.comwrote in message
news:11**********************@d30g2000prg.googlegr oups.com...
Hello all,

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

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.Connect();
ManagementObjectSearcher objSearcher = new
ManagementObjectSearcher("Select * from Win32_Printer");
foreach (ManagementObject printer in objSearcher.Get())
{
sysName =
printer["SystemName"].ToString().ToLower();
printerName =
printer["Name"].ToString().ToLower();
}
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.guard.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.com

"TARUN" <tarun.si...@gmail.comwrote in message

news:11**********************@d30g2000prg.googlegr oups.com...
Hello all,
Please help and suggest the code to get the printer status over the
network.
for Example, i have an string "\\\\os1\\PtName"
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
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...
7
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...
5
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...
3
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....
1
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...
2
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...
2
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,...
9
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...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.