forked from Azure/azureml-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindows-Install-RStudio-opensource.ps1
29 lines (26 loc) · 1.42 KB
/
Windows-Install-RStudio-opensource.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Write-Host "#### Installing Chocolatey #########"
$chocoExePath = 'C:\ProgramData\Chocolatey\bin'
if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) {
Write-Log "Chocolatey found in PATH, skipping install..."
} else {
Write-Log "Installing Chocolatey..."
# Add to system PATH
$systemPath = [environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine)
$systemPath += ';' + $chocoExePath
[environment]::SetEnvironmentVariable("PATH",$systemPath,[System.EnvironmentVariableTarget]::Machine)
# Update local process' path
$userPath = [environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::User)
if ($userPath) {
$env:Path = $systemPath + ";" + $userPath
} else {
$env:Path = $systemPath
}
# Run the installer
Invoke-Expression ((New-Object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
}
choco feature enable --name allowGlobalConfirmation # stop the -y flag being needed for all "choco install"s
choco feature disable --name checksumFiles # lots of packages have no checksums, e.g. WinSDK, so allow them
choco install -y vcredist140
Write-Host "#### Installing Rstudio #########"
C:\ProgramData\chocolatey\choco install r.studio -y
Write-Host "#### Completed Rstudio installtion with choco #########"