Skip to content

Instantly share code, notes, and snippets.

@SteffenL
Last active February 7, 2020 08:37
Show Gist options
  • Save SteffenL/90c521ba455ebba16bb6c7f5fd7c341e to your computer and use it in GitHub Desktop.
Save SteffenL/90c521ba455ebba16bb6c7f5fd7c341e to your computer and use it in GitHub Desktop.
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$wc = New-Object System.Net.WebClient
# Retrieve resources
New-Item -ItemType Directory -Force -Path "C:\res"
$wc.DownloadFile("https://gist.githubusercontent.com/SteffenL/913d478d4afad265e5fa8b416dfc965d/raw/2412aff8c914b3964d361038235ebae3da21c6b3/vs2019-cpp.vsconfig", "C:\res\.vsconfig")
$wc.DownloadFile("https://download.visualstudio.microsoft.com/download/pr/8ab6eab3-e151-4f4d-9ca5-07f8434e46bb/8cc1a4ebd138b5d0c2b97501a198f5eacdc434daa8a5c6564c8e23fdaaad3619/vs_Community.exe", "C:\res\vs_Community.exe")
$wc.DownloadFile("http://files.jrsoftware.org/is/6/innosetup-6.0.3.exe", "C:\res\innosetup-6.0.3.exe")
$wc.DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "C:\res\GoogleCloudSDKInstaller.exe")
# Install Chocolatey
if ($chocoPath = $env:ChocolateyInstall) {
Remove-Item -Recurse -Force $env:ChocolateyInstall -ErrorAction Continue
}
Invoke-Expression ($wc.DownloadString("https://chocolatey.org/install.ps1"))
# Install tools
&choco install -y git openjdk11 maven python
&choco install -y cmake --installargs "ADD_CMAKE_TO_PATH=System"
&C:\res\GoogleCloudSDKInstaller.exe /S /allusers /noreporting /nostartmenu /nodesktop | Out-Null
&C:\res\innosetup-6.0.3.exe /VERYSILENT /NORESTART /ALLUSERS | Out-Null
# Set environment variables
$extraPaths =
"$([Environment]::GetEnvironmentVariable("M2_HOME", "Machine"))\bin",
"${env:ProgramFiles(x86)}\Inno Setup 6",
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build",
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
$userPaths = $env:Path -split ";"
$machinePaths = [Environment]::GetEnvironmentVariable("PATH", "Machine") -split ";"
[Environment]::SetEnvironmentVariable("PATH", (($extraPaths + $machinePaths) | select -Unique) -join ";", "Machine")
$env:Path = (($extraPaths + $userPaths + $machinePaths) | select -Unique) -join ";"
# Install Python packages
&pip install awscli conan
# Check command presence
&java -version
&mvn --version
&python --version
&cmake --version
&aws --version
&conan --version
Get-Command iscc
# Install Visual Studio
&C:\res\vs_Community.exe --quiet --wait --norestart --nocache --config C:\res\.vsconfig | Out-Null
# Check Visual Studio command presence
Get-Command vcvarsall
Get-Command msbuild
# Clean up
Remove-Item -Recurse -Force "C:\res"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment