To install the XPS Viewer on Windows 11 via the command line, open PowerShell as an Administrator and run the command Add-WindowsCapability -Online -Name "Xps.Viewer~~~~0.0.1.0". This process uses the Deployment Image Servicing and Management (DISM) framework to download and enable the XPS Viewer optional feature directly from Microsoft servers, allowing you to view .xps and .oxps files without navigating through the graphical Settings menu.
What You'll Need
- A computer running Windows 11.
- An active internet connection (required to download the feature files from Windows Update).
- Administrative privileges on the local machine.
Step-by-Step
- Open the Start Menu: Press the Windows key on your keyboard or click the Start icon in the taskbar.
- Launch PowerShell as Administrator: Type "PowerShell" into the search bar. Right-click on "Windows PowerShell" from the results and select "Run as administrator". When the User Account Control (UAC) prompt appears, click "Yes" to confirm.
- Enter the Installation Command: Copy and paste the following command into the PowerShell window, then press Enter:
Add-WindowsCapability -Online -Name "Xps.Viewer~~~~0.0.1.0"
Note: The tildes (~~~~) are a required part of the package name syntax. - Monitor the Progress: You will see a progress bar indicating that the system is searching for the capability and downloading the necessary files. This may take a few minutes depending on your connection speed.
- Verify Completion: Once the process finishes, the "Path" column should show "Online" and the "RestartNeeded" column should say "False".
- Launch the Viewer: You can now open an XPS file by double-clicking it, or you can find the app by searching for "XPS Viewer" in the Start menu.
Common Mistakes
- Running without Administrator rights: If you open PowerShell as a standard user, the command will fail with an "Access Denied" or "Privilege" error. Always ensure the window title says "Administrator: Windows PowerShell".
- Typing errors in the package name: The string
"Xps.Viewer~~~~0.0.1.0"must be exact. Missing a tilde or adding a space inside the quotes will result in a "Capability not found" error. - Disconnecting from the Internet: Because this is an "On-Demand" feature, Windows does not keep the installation files on your hard drive by default. If you are offline, the command will fail.
Tips
- Using Command Prompt (CMD) instead: If you prefer the traditional Command Prompt over PowerShell, you must use the DISM tool. Run CMD as administrator and use this command:
dism /Online /Add-Capability /CapabilityName:Xps.Viewer~~~~0.0.1.0 - Checking if it is already installed: To see if the XPS Viewer is already present before trying to install it, run:
Get-WindowsCapability -Online -Name "Xps.Viewer*" - Setting as Default: After installation, right-click an .xps file, select "Open with" > "Choose another app", select "XPS Viewer", and check the box "Always use this app to open .xps files".
Troubleshooting
If the installation does not go as planned, try these steps in order:
- Check Internet Connection: Ensure you are not behind a restrictive firewall or VPN that might block access to Windows Update servers.
- Restart the Windows Update Service: Sometimes the background service responsible for optional features hangs. Open the "Services" app, find "Windows Update", right-click it, and select "Restart".
- Run Windows Update: Go to Settings > Windows Update and check for updates. If your system has pending critical updates, it may block the installation of optional capabilities.
- Check Group Policy (for Work PCs): If you are on a corporate machine, your IT department may have disabled the ability to download optional features from Windows Update. If you receive an error mentioning "WSUS" or "Policy," you will need to contact your system administrator.
Frequently Asked Questions
Is the XPS Viewer free?
Yes, it is a built-in optional feature provided by Microsoft for Windows 11 users at no additional cost.
What is the difference between .xps and .oxps?
.xps is the older XML Paper Specification format, while .oxps is the "Open XPS" version. The XPS Viewer can open both formats.
Can I uninstall the XPS Viewer using the command line?
Yes. Run PowerShell as administrator and use the command: Remove-WindowsCapability -Online -Name "Xps.Viewer~~~~0.0.1.0".
Why isn't XPS Viewer installed by default on Windows 11?
Microsoft moved it to an "Optional Feature" to reduce the initial disk footprint of the operating system, as most users now prefer PDF files.
Is there a way to create XPS files in Windows 11?
While the Viewer only lets you see files, you can create them by using the "Microsoft Print to XPS" printer option in the Print menu of most applications.