Permanently removing Microsoft XPS Document Writer pseudoprinter object?

Solution 1:

For reasons unknown, a great many of the (Windows XP SP3) computers I manage have recently started creating a new pseudoprinter object, called Microsoft XPS Document Writer, seemingly out of nowhere.

If I read things correctly the original version of XPS Document Writer and related components for Windows XP shipped as part of .NET Framework 3.0, see for example Viewing and creating XPS documents. Consequently I suppose the reason why these components do appear on those systems to be an explicit or implicit installation of .NET Framework 3.0, e.g. triggered by another software which depends on it.

I would love a utility like this that just deletes the pseudoprinter object, driver, etc., without user interaction, so it can be run from the login script.

Presumably this installation is based on Windows Installer under the hood, which features proper uninstall functionality for system administrators by design, even in the absence of an explicit Add/Remove Program entry for end users, see Standard Installer Command-Line Options (also shown if executing msiexec /? on a command line), for example:

msiexec /uninstall /quiet YourInstallationPackage.msi
msiexec /uninstall /quiet {12345678-1234-1234-1234-123456789012}

Consequently there are some constraints though:

  • The functionality to be uninstalled must have been provided as a Windows Installer package (.msi) in the first place of course, even if this package has in turn been bundled/packed within another entity, e.g. the .NET Framework installer; this may not necessarily be the case, even though I'd be surprised if not.
  • As shown you'll either need access to the original installation package (.msi), which is usually getting cached on the system for purposes like this, or you'll need the so called ProductCode of the package as recorded in the system wide Windows Installer database.

This is where things get tricky (and potentially dangerous) regarding your example, because you'll need to find either one of these on your system:
The Windows Installer cache is usually located in C:\Windows\Installer, the Windows Installer product codes are registered under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall. Obviously you'll first need some term to look for (e.g. 'XPS') and for every find you should definitely verify whether it actually denotes the package you are looking for, else you might end up accidentally removing important stuff.


Alternative approach:

Apparently the Microsoft XML Paper Specification Essentials Pack is an update to those bits delivered via .NET Framework 3.0 (see this article). Given this is an official Windows installer package, the uninstallation as outlined above should definitely work. I peaked into the package via Orca, and not surprisingly it seems to include custom actions for uninstalling older components if present. Consequently you may be able to install this package first, implying removal of the bits installed via the .NET Framework, and immediately uninstall it again thereafter to get rid of XPS functionality entirely:

msiexec /install /quiet 'XPSEP XP and Server 2003 32 bit.msi'
msiexec /uninstall /quiet 'XPSEP XP and Server 2003 32 bit.msi'

It definitely seems odd to install more stuff first, and it might or might not work, but in the end it may be simpler and hence worth a try.

Solution 2:

Run this as a startup script

Cscript %WINDIR%\System32\prnmngr.vbs -d -p "Microsoft XPS Document Writer"