$ErrorActionPreference = "Stop" $ps_profile_path = $env:USERPROFILE + '\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1' $os_version = (Get-WmiObject -class Win32_OperatingSystem).Caption $ps_profile = 'pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build" cmd /c "vcvars64.bat&set" | foreach { if ($_ -match "=") { $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" } } popd Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow' Set-ExecutionPolicy Unrestricted Invoke-WebRequest "https://aka.ms/vs/15/release/vs_BuildTools.exe" -OutFile vs_BuildTools.exe -UseBasicParsing ;` Start-Process -FilePath 'vs_BuildTools.exe' -ArgumentList '--quiet', '--norestart', '--locale en-US', '--add Microsoft.VisualStudio.Component.VC.CoreBuildTools', '--add Microsoft.VisualStudio.Component.Windows10SDK', '--add Microsoft.Net.Component.4.6.1.SDK', '--add Microsoft.Net.Component.4.6.1.TargetingPack', '--add Microsoft.VisualStudio.Component.VC.ATL', '--add Microsoft.VisualStudio.Component.VC.CLI.Support', '--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64', '--add Microsoft.VisualStudio.Component.Windows10SDK.10586', '--add Microsoft.VisualStudio.Component.VC.Modules.x86.x64', '--add Microsoft.Component.VC.Runtime.UCRTSDK', '--add Microsoft.VisualStudio.Component.Windows81SDK ' -Wait ;` Remove-Item .\vs_BuildTools.exe ;` Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer' if ($os_version -like '*Microsoft Windows Server 2016*') { Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name DockerMsftProvider -Force Install-Package -Name docker -ProviderName DockerMsftProvider -Force } if ($os_version -like '*Microsoft Windows 10*') { $DockerInstaller = Join-Path $Env:Temp InstallDocker.msi Invoke-WebRequest https://download.docker.com/win/stable/InstallDocker.msi -OutFile $DockerInstaller msiexec -i $DockerInstaller -quiet } iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) choco install --force -y git choco install --force -y python2 choco install --force -y cmake choco install --force -y unzip choco install --force -y sysinternals choco install --force -y 7zip choco install --force -y notepadplusplus c:\Python27\scripts\pip.exe install pybars3 setx /M PATH $($Env:PATH + ';' + ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;' + ${Env:ALLUSERSPROFILE} + '\chocolatey\bin;C:\python27;') #[Environment]::SetEnvironmentVariable("Path", $path, [EnvironmentVariableTarget]::Machine) $TARGETDIR = $env:USERPROFILE + '\Documents\WindowsPowerShell' if(!(Test-Path -Path $TARGETDIR )){ new-Item $env:USERPROFILE + '\Documents\WindowsPowerShell' -type directory } Set-Content -Path $ps_profile_path -Value "$ps_profile"