In all of my brilliant wisdom, I thought it would be a wise idea to remove the Microsoft XPS Document Writer from all of my machines.
Why did I do this? Well – three years ago, I had a site that switched to Windows 7. A common complaint was that their default printer would sometimes change to the XPS document writer and the user didn’t know where that printer was located. It was useless to explain that it was a “fictional” printer so I did the logical thing and deleted the printer using Group Policy Preferences. Boy was I dumb! Until now, I thought I was stuck with that change.
Why was I so dumb? Well, now users want to be able to create XPS documents instead of PDF documents. I tried (and failed) to change it to a create preference. Even though the printer driver was still on the machine, a Printer Preference requires a remote printer to connect to. Knowing this, I tried to share the XPS printer on another machine. Sadly, that type of printer could not be shared.
Just when I was about to put that project on hold, I thought about PowerShell.
I took a look at the help file for Add-Printer. The first example was:
So in a single line, I was able to add the printer back automatically!! Now I can use Group Policy Shutdown Scripts to reinstall this printer. In the future, I won’t remove something unless I am sure I can add it back. Lesson learned!
Now that you have gotten your XPS Printer reinstalled, have you thought about how many old printers and ports are still installed? Find out which printers are truly offline and for how long!
By the way – if someone does get this to work with Preferences, leave me a comment!
fast forward to 2018 and quickbooks deleted my document writer program – and can’t re-install it. The bottom line – after 5 qb techs, 3 microsft techs, numerous web sites etc – buy a new computer. Anyone have any better answers?
If Group Policies are not used or not available:
This is what I just did on a 2008 server:
Go through the regular motion of adding a printer with the wizard:
– add local printer
– use existing port “XPSPort”
– Select Manufacturer Microsoft, then the XPS Doc. Writer printer.
Then finish up with the wizard as usual.
Thank you Uwe!
This only works on windows 8 – the script below works for windows 7
$printerclass = [wmiclass]’Win32_Printer’
$printer = $printerclass.CreateInstance()
$printer.Name = $printer.DeviceID = ‘Microsoft XPS Document Writer’
$printer.PortName = ‘XPSPort:’
$printer.Network = $false
$printer.Shared = $false
$printer.DriverName = ‘Microsoft XPS Document Writer’
Thank you Simon!
Hmm i tried but it doesnt work:
Die Benennung “Add-Printer” wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbare
n Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und w
iederholen Sie den Vorgang.
Bei Zeile:1 Zeichen:12
+ Add-Printer <<<< -Name "mxdw 2" -DriverName "Microsoft XPS Document Writer v4" -PortName "portprompt:"
+ CategoryInfo : ObjectNotFound: (Add-Printer:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
sorry that this is in german