I want to find wheather printer is connected or not in client computer,
for this i have written code as
ManagementScope scope = new ManagementScope("\\root\\cimv2");
// Select Printers from WMI Object Collections
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
string printerName = "";
foreach (ManagementObject printer in searcher.Get())
printerName = printer["Name"].ToString().ToLower();
// Console.WriteLine("Printer = " + printer["Name"]);
// printer is offline by user
// Console.WriteLine("Your Plug-N-Play printer is not connected.");
// printer is not offline
Console.WriteLine("Your Plug-N-Play printer is connected.");
The code above is giving me status of printer of the server where my code is hosted,But i want the status of printer of client pc.
Take a look at the printer["Local"] property.
If it is True then is a Local printer, if not is a network printer.
Edited 28-Jan-13 5:41am
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)