473,221 Members | 2,184 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,221 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 4197
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 its 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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.