How to install Winget on Windows Server 2019/2022

a blue sign with white text

Winget, or the Windows Package Manager, is a powerful tool for managing applications and packages on Windows systems. Unfortunately, Winget is not natively supported on Windows Server editions. However, it can still be installed using a custom PowerShell script. In this guide, we’ll walk you through the process of installing Winget on Windows Server 2019 or 2022 using the WinGet_Script.ps1 script.

Prerequisites

Before starting, ensure the following:

  1. Windows Server Version:
    • Your system must be running Windows Server 2019 or Windows Server 2022.
  2. PowerShell Version:
    • The script requires a version of PowerShell prior to 7.0. Ensure you are using Windows PowerShell 5.1, which is the default version included with Windows Server.
  3. Administrator Privileges:
    • You need administrative privileges to execute the script and make system-level changes.
  4. Internet Connectivity:
    • Ensure your server has an active internet connection for downloading required components.

Step-by-Step Installation

Step 1: Download the Script

Download the WinGet_Script.ps1 script from This Link – this link Save it to a location on your server, such as C:\Scripts.

Step 2: Open PowerShell as Administrator

  1. Press Win + R, type powershell, and press Ctrl + Shift + Enter to open PowerShell as Administrator.
  2. Navigate to the directory where you saved the script:
cd C:\Scripts
a screenshot of a computer

Step 3: Set Execution Policy

If your system has restricted script execution, you may need to adjust the execution policy. Run the following command to allow running scripts:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Note: Use this command cautiously and revert to your default policy after installation.

a screenshot of a computer

Step 4: Run the Script

Execute the script using the following command:

.\WinGet_Script.ps1
a screenshot of a computer

The script will:

  • Install the necessary dependencies for Winget.
  • Download and configure Winget for use on your Windows Server.

Step 5: Verify the Installation

After the script completes, verify that Winget is installed by running:

winget --version

If installed successfully, the version number of Winget will be displayed.

a screenshot of a computer

Troubleshooting

  • PowerShell Version Issues: Ensure you are not using PowerShell Core (7.0 or later). Run Get-Host | Select-Object Version to confirm your PowerShell version.
  • Execution Policy Errors: If you encounter issues with the execution policy, ensure you’re running PowerShell as Administrator.
  • Dependency Errors: The script handles dependency installation automatically. If any component fails, check the error message for details and manually install the required software.

Conclusion

By following this guide, you’ve successfully installed Winget on your Windows Server 2019 or 2022 system. With Winget, you can easily manage and install packages, streamlining your server administration tasks.

If you encounter any issues or have feedback, feel free to reach out via the Commenting on The website.

2 Comments

  1. WhiteKnight

    why not sharing the powershell script in a code block on the page, shrinkme.ink site is blocking me from getting the scripts

    • Bro, if you want to download the script you have to disable your antivirus for few minutes.

Leave a Reply

Your email address will not be published. Required fields are marked *