Skip to content

Instantly share code, notes, and snippets.

@TrimarcJake
Forked from bentman/Add-DevToMyWinServer.ps1
Created January 24, 2024 13:40
Show Gist options
  • Save TrimarcJake/74441912a2d3c41af463fdd5a433c33b to your computer and use it in GitHub Desktop.
Save TrimarcJake/74441912a2d3c41af463fdd5a433c33b 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.7.3 (github)
winget-cli v1.6.2771 (github)
Microsoft pwsh.exe vCurrent (winget)
Microsoft.WindowsTerminal v1.18.2822.0 (github)
Microsoft VSCode vCurrent (winget)
Azure CLI vCurrent (PoSh/MSI)
.NOTES
Add-DevToMyWinServer.ps1
Version: 1.0
Creation Date: 2023-10-20
Copyright (c) 2023 https://github.com/bentman
#>
# From github Microsoft.VCLibs
$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.7.3/Microsoft.UI.Xaml.2.7.x64.appx'
$MsftUi_Name = 'Microsoft.UI.Xaml.2.7.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.6.2771/27abf0d1afe340e7a64fb696056b2672_License1.xml'
$LicXml_Name = '27abf0d1afe340e7a64fb696056b2672_License1.xml'
Invoke-WebRequest -Uri $LicXml_Link -OutFile .\$LicXml_Name
$WinGet_Link = 'https://github.com/microsoft/winget-cli/releases/download/v1.6.2771/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
# 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
# From github Microsoft.WindowsTerminal https://github.com/microsoft/terminal/releases
$Term_Link = 'https://github.com/microsoft/terminal/releases/download/v1.18.2822.0/Microsoft.WindowsTerminal_1.18.2822.0_8wekyb3d8bbwe.msixbundle'
$Term_Name = 'Microsoft.WindowsTerminal_1.18.2822.0_8wekyb3d8bbwe.msixbundle'
Invoke-WebRequest -Uri $Term_Link -OutFile .\$Term_Name -Verbose
Add-AppPackage -Path .\$Term_Name -Verbose
# 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
# Install Azure CLI
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi
Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
Remove-Item .\AzureCLI.msi
@bentman
Copy link

bentman commented May 26, 2024

Updated with dynamic version retrieval...

  • winget-cli (api.github.com)
  • Microsoft.WindowsTerminal (api.github.com)

https://gist.github.com/bentman/638c478ae791598780c70749139e382f

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