Is there a possibility to differ virtual printer from physical one?

I have a list of all printers available in WinXP. I need the code (ideally .NET) to filter out all the virtual printers from this list. Is it possible to do? I analyzed all the properties of Win32_Printer wmi class but can't see any suitable one. Please help.

Answers


I don't think it's possible, at least with any certainty. The whole point of a virtual printer is to imitate a real one as closely as possible, so any differences you can identify are basically just bugs in the virtual printer.

That said, you can make some guesses based on the PortName. Just for a couple of examples, a PortName that includes an IP address or starts with "USB" is likely to refer to a physical connection.


I know this is an old question but this answer may be helpful to someone with the same problem.

If my understanding of a "virtual printer" is correct. You could check the WMI property "PrintProcessor" and ignore "winprint". To my knowledge this will ignore all of Windows 7 software based printer options. Here is some sample code to demonstrate that. Returns the printer name.

        using System.Management;

        try
        {
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Printer");

            foreach (ManagementObject obj in searcher.Get())
            {
                if(obj != null)
                {
                    if(obj["PrintProcessor"].ToString().ToUpper() != "WINPRINT")
                    {
                        Console.WriteLine(obj["Name"]);
                    }
                }
            }
        }
        catch (ManagementException e)
        {
            MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
        }

Need Your Help

Boost serialization version information

c++ boost boost-serialization

Is there any way to remove the extra 6 bytes that are put in the begin of the serialization data when serializing with Boost Serialization ? I just want to use the serialization mechanism, I don't ...

Installing FreePBX as a Virtual machine

openstack pbx freepbx

I have been trying to launch FreePBX as a VM on Openstack. The launching is successful. but the during the installation time I get the following error:Some first boot error occured and the system ...