For quite some time I had my home printer connected to a USB port on one of my ESXi hosts. To save a bit of memory I doubled up my home lab’s AD domain controller as a print server. I did this because the only other non-virtual computer at home capable of printer sharing was running Windows 7 and for some reason I could not get my Mac to work properly with the printer when it was shared from that. (Authentication would fail when trying to connect to it via SMB.)
The downside of this arrangement though was that my AD VM was tied to that single ESXi host. I couldn’t vMotion it without losing the printing functionality – something that my wife quite rightly complained to me about on several occasions! Obviously I should probably just get a new wireless printer and solve the problem that way. Believe me it's tempting but I so rarely print that it seems slightly wasteful whilst the old printer still works and I was also determined to make it work and bend it to my will.
Finally I did some digging and found a way to make it work. The printer is now shared from the Windows 7 desktop and usable by me and my Mac, my wife from her laptop and the children from the PC itself.
How? Like this…
On the PC:
1. Open The Control Panel.
2. Select “Programs and Features”.
3. Click the link to “Turn Windows Features on of off”.
4. Under “Print and Document Services” enable the “LPD Print Service”. Click “OK”.
5. Finally share your Windows printer as normal.
On the Mac:
1. Open System Preferences
2. Open “Print & Fax”.
3. Click the little “+” icon to add a new printer.
4. In the “Add Printer” dialog select the “Advanced” section.
- Select “LPD/LPR Host or Printer” as the type.
- In the “URL” field enter the URL in the format lpd://ipaddressorhostname/printersharename
- Give the printer a suitable name.
5. Select a driver by selecting “Select Printer Software” from the “Print Using” dropdown (note that I have CUPS+Gutenprint drivers installed to give me a wider selection of drivers).
6. Finally “Add” your chosen printer.
It should be noted that this solution of course requires that the PC be on for printing to be possible. Most of the time the one that I am using is asleep or hibernated and I just give it a poke with a WOL packet generated from a local webpage when I need to print. It's not like I do a lot of printing anyway.