Before starting, you need to make sure that you are NOT running under Administrator account!

Administrator account can NOT start store apps.

After starting new Windows Server, start a new PowerShell session with Administrator privilege.

Run the following commands:

function Install-Package {
    param (
        [string]$PackageFamilyName
    )

    Write-Host "Querying latest $PackageFamilyName version and its dependencies..."
    $response = Invoke-WebRequest `
        -Uri "https://store.rg-adguard.net/api/GetFiles" `
        -Method "POST" `
        -ContentType "application/x-www-form-urlencoded" `
        -Body "type=PackageFamilyName&url=$PackageFamilyName&ring=RP&lang=en-US" -UseBasicParsing

    Write-Host "Parsing response..."
    $regex = '<td><a href=\"([^\"]*)\"[^\>]*\>([^\<]*)<\/a>'
    $packages = (Select-String $regex -InputObject $response -AllMatches).Matches.Groups

    $result = $true
    for ($i = $packages.Count - 1; $i -ge 0; $i -= 3) {
        $url = $packages[$i - 1].Value;
        $name = $packages[$i].Value;
        $extCheck = @(".appx", ".appxbundle", ".msix", ".msixbundle") | % { $x = $false } { $x = $x -or $name.EndsWith($_) } { $x }
        $archCheck = @("x64", "neutral") | % { $x = $false } { $x = $x -or $name.Contains("_$($_)_") } { $x }

        if ($extCheck -and $archCheck) {
            # Skip if package already exists on system
            $currentPackageFamilyName = (Select-String "^[^_]+" -InputObject $name).Matches.Value
            $installedVersion = (Get-AppxPackage "$currentPackageFamilyName*").Version
            $latestVersion = (Select-String "_(\d+\.\d+.\d+.\d+)_" -InputObject $name).Matches.Value
            if ($installedVersion -and ($installedVersion -ge $latestVersion)) {
                Write-Host "${currentPackageFamilyName} is already installed, skipping..." -ForegroundColor "Yellow"
                continue
            }

            try {
                Write-Host "Downloading package: $name"
                $tempPath = "$(Get-Location)\$name"
                Invoke-WebRequest -Uri $url -Method Get -OutFile $tempPath
                Add-AppxPackage -Path $tempPath
                Write-Host "Successfully installed:" $name
            } catch {
                $result = $false
            }
        }
    }

    return $result
}

function Install-Package-With-Retry {
    param (
        [string]$PackageFamilyName,
        [int]$RetryCount
    )

    for ($t = 0; $t -le $RetryCount; $t++) {
        Write-Host "Attempt $($t + 1) out of $RetryCount..." -ForegroundColor "Cyan"
        if (Install-Package $PackageFamilyName) {
            return $true
        }
    }

    return $false
}

And run the following PowerShell:

    # Retry 3 times because we don't know dependency relationships
    $result = @("Microsoft.DesktopAppInstaller_8wekyb3d8bbwe") | % { $x = $true } { $x = $x -and (Install-Package-With-Retry $_ 3) } { $x }
    
    # Test if winget has been successfully deployed
    if ($result -and (Test-Path -Path "$env:LOCALAPPDATA\Microsoft\WindowsApps\winget.exe")) {
        Write-Host "Congratulations! winget is now installed on your system :)" -ForegroundColor "Green"
    } else {
        Write-Host "Oops... Failed to install winget on your system :(" -ForegroundColor "Red"
    }

After running, winget will be installed. You may see temporary errors.

Try to run winget. If it failed to install, do the following steps.

Open this page in your browser on server:

https://github.com/microsoft/winget-cli/releases

Download these two files:

After downloading, run the following command in your downloaded folder (Server must connect to Internet):

Add-ProvisionedAppPackage -Online -PackagePath .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -LicensePath .\e40f7d30e22c4c0eb9194f5e9aed26b8_License1.xml

And that will install winget with license. Try to start a new session, and you will see winget available.

You can install Windows Terminal with winget now.

Try winget install Microsoft.WindowsTerminal.

If failed, you can try:

    # Retry 3 times because we don't know dependency relationships
    $result = @("Microsoft.WindowsTerminal_8wekyb3d8bbwe") | % { $x = $true } { $x = $x -and (Install-Package-With-Retry $_ 3) } { $x }

You can also install the following apps:

# snipping tool
winget install --id 9MZ95KL8MR0L
# Sticky notes
winget install --id 9NBLGGH4QGHW
# Clock
winget install --id 9WZDNCRFJ3PR
# Mail and calendar
winget install --id 9WZDNCRFHVQM

To reset Windows Store, you can try this:

(Only support Windows 10 LTSC. May not work on Windows Server)

# Powershell (Admin)
wsreset -i
wsreset