-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathInstall-VS2017Community.ps1
23 lines (19 loc) · 1.26 KB
/
Install-VS2017Community.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (!(Test-Path function:AddToStatus)) {
function AddToStatus([string]$line, [string]$color = "Gray") {
("<font color=""$color"">" + [DateTime]::Now.ToString([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortTimePattern.replace(":mm",":mm:ss")) + " $line</font>") | Add-Content -Path "c:\demo\status.txt" -Force -ErrorAction SilentlyContinue
Write-Host -ForegroundColor $color $line
}
}
$Folder = "C:\DOWNLOAD\VisualStudio2017Community"
$Filename = "$Folder\vs_community.exe"
New-Item $Folder -itemtype directory -ErrorAction ignore | Out-Null
if (!(Test-Path $Filename)) {
AddToStatus "Downloading Visual Studio 2017 Community Setup Program"
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://aka.ms/vs/15/release/vs_community.exe", $Filename)
}
AddToStatus "Installing Visual Studio 2017 Community (this might take a while)"
$setupParameters = “--quiet --norestart"
Start-Process -FilePath $Filename -WorkingDirectory $Folder -ArgumentList $setupParameters -Wait -Passthru | Out-Null
$setupParameters = “--quiet --norestart --add Microsoft.VisualStudio.Component.Windows10SDK.14393"
Start-Process -FilePath $Filename -WorkingDirectory $Folder -ArgumentList $setupParameters -Wait -Passthru | Out-Null