Search code examples
c#.netwmiwsd

Can I use WMI to manage WSD devices (specifically printers)?


I am using WMI with C# to enumerate and modify the printers on my computer.

I'm running Windows 7, and everything is working fine when I try to modify printers that are installed "classically". By "classically", I mean that the printer is just using a basic TCP/IP Port. I can rename it, set it as the default printer, etc. using the documented WMI functions here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394363(v=vs.85).aspx.

However, by default Windows is installing my printer as a WSD (Web Services on Devices) printer. When this happens, the printer uses a WSD Port, which I can't seem to touch using WMI.

In the screenshot below, you can see that my printer is using a "WSD Port". Below that port is the standard TCP/IP Port that my printer uses when installed without WSD.

Screenshot

The software that came with my printer installs the printer using a standard TCP/IP port. However, when I manually install my printer, Windows chooses the WSD port.

WMI seems to have no definition for WSD enabled devices. Does anyone know if this is true?


Solution

  • It should be in your WMI, all printers shown in your Devices and Printers are listed on WMI. To give you an example I have a similar situation where I have a printer using the WSD portname and we can manage it from code.

    enter image description here