Skip to content

Instantly share code, notes, and snippets.

@bentman
Last active May 21, 2024 11:36
Show Gist options
  • Save bentman/638c478ae791598780c70749139e382f to your computer and use it in GitHub Desktop.
Save bentman/638c478ae791598780c70749139e382f to your computer and use it in GitHub Desktop.
Script to install Dev Tools on Windows Server 2022
<#
.SYNOPSIS
Script to install Dev Tools on Windows Server (tested on 2022)
.DESCRIPTION
Installs the following from multiple resources:
Microsoft.VCLibs v14.00 (github)
Microsoft.UI v2.8.6 (github)
winget-cli v1.7.11132 (github)
Microsoft.WindowsTerminal v1.19.11213.0 (github)
Microsoft pwsh.exe vCurrent (winget)
Microsoft VSCode vCurrent (winget)
Azure CLI vCurrent (PoSh/MSI)
.NOTES
Add-DevToMyWinServer.ps1
Version: 1.2
Creation Date: 2024-05-04
Copyright (c) 2023 https://github.com/bentman
#>
# From Microsoft.VCLibs redirect
$MsftVc_Link = 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$MsftVc_Name = 'Microsoft.VCLibs.x64.14.00.Desktop.appx'
Invoke-WebRequest -Uri $MsftVc_Link -OutFile .\$MsftVc_Name -Verbose
Add-AppPackage -Path .\$MsftVc_Name -Verbose
# From github Microsoft.UI.Xaml https://github.com/microsoft/microsoft-ui-xaml/releases
$MsftUi_Link = 'https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx'
$MsftUi_Name = 'Microsoft.UI.Xaml.2.8.x64.appx'
Invoke-WebRequest -Uri $MsftUi_Link -OutFile .\$MsftUi_Name -Verbose
Add-AppPackage -Path .\$MsftUi_Name -Verbose
# From github winget-cli https://github.com/microsoft/winget-cli/releases
$LicXml_Link = 'https://github.com/microsoft/winget-cli/releases/download/v1.7.11132/ccfd1d114c9641fc8491f3c7c179829e_License1.xml'
$LicXml_Name = 'ccfd1d114c9641fc8491f3c7c179829e_License1.xml'
Invoke-WebRequest -Uri $LicXml_Link -OutFile .\$LicXml_Name
$WinGet_Link = 'https://github.com/microsoft/winget-cli/releases/download/v1.7.11132/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
$WinGet_Name = 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Invoke-WebRequest -Uri $WinGet_Link -OutFile .\$WinGet_Name
Add-AppxProvisionedPackage -Online -PackagePath .\$WinGet_Name -LicensePath .\$LicXml_Name -Verbose
# From github Microsoft.WindowsTerminal https://github.com/microsoft/terminal/releases
$Term_Link = 'https://github.com/microsoft/terminal/releases/download/v1.19.11213.0/Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle'
$Term_Name = 'Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle'
Invoke-WebRequest -Uri $Term_Link -OutFile .\$Term_Name -Verbose
Add-AppPackage -Path .\$Term_Name -Verbose
# WinGet look for pwsh.exe versions (may prompt to accept terms)
winget search Microsoft.PowerShell
# Install pwsh.exe from winget
winget install --id Microsoft.Powershell --source winget
# WinGet look for VS Code versions (it may prompt to accept terms)
winget search Microsoft.VisualStudioCode
# Install VS Code from winget
winget install --id Microsoft.VisualStudioCode --source winget
# WinGet look for AzureCLI (it may prompt to accept terms)
winget search Microsoft.AzureCLI
# Install AzureCLI from winget
winget install --id Microsoft.AzureCLI --source winget
winget update all
@TrimarcJake
Copy link

Thanks! This rules!

@bentman
Copy link
Author

bentman commented May 4, 2024

Updated versions...
winget-cli v1.7.11132 (github)
Microsoft.WindowsTerminal v1.19.11213.0 (github)

@JonSuper
Copy link

VERBOSE: GET https://github.com/microsoft/terminal/releases/download/v1.19.11213.0/Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle with 0-byte payload
VERBOSE: received 21550188-byte response of content type application/octet-stream
VERBOSE: Performing the operation "Deploy package" on target "D:\Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle".
Add-AppPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.WindowsTerminal_1.19.11213.0_x64__8wekyb3d8bbwe because this package depends on a framework that could not be found. Provide the framework "Microsoft.UI.Xaml.2.8" published by "CN=Microsof
t Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version 8.2305.5001.0, along with this package to install. The frameworks with name "Microsoft.UI.Xaml
.2.8" currently installed are: {}

fail on Windows Server 2022
should upgrade to 2.8:
$MsftUi_Link = 'https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx'

@bentman
Copy link
Author

bentman commented May 21, 2024

> fail on Windows Server 2022 should upgrade to 2.8: $MsftUi_Link = 'https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx'

yup. looking for a way to do them all more 'dynamically' (aka - query the latest version to download). i'll update the static until then. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment