summaryrefslogtreecommitdiff
path: root/omnibus/omnibus-test.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'omnibus/omnibus-test.ps1')
-rw-r--r--omnibus/omnibus-test.ps125
1 files changed, 22 insertions, 3 deletions
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1
index 2c4331ff2f..906b403c9a 100644
--- a/omnibus/omnibus-test.ps1
+++ b/omnibus/omnibus-test.ps1
@@ -2,9 +2,28 @@
$ErrorActionPreference = "Stop"
# install chocolatey
-Set-ExecutionPolicy Bypass -Scope Process -Force
-[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
-iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
+function installChoco {
+
+ if (!(Test-Path "$($env:ProgramData)\chocolatey\choco.exe")) {
+ Write-Output "Chocolatey is not installed, proceeding to install"
+ try {
+ write-output "installing in 3..2..1.."
+ Set-ExecutionPolicy Bypass -Scope Process -Force
+ [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
+ iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
+ }
+
+ catch {
+ Write-Error $_.Exception.Message
+ }
+ }
+
+ else {
+ Write-Output "Chocolatey is already installed"
+ }
+}
+
+installChoco
# install powershell core
Invoke-WebRequest "https://github.com/PowerShell/PowerShell/releases/download/v7.0.3/PowerShell-7.0.3-win-x64.msi" -UseBasicParsing -OutFile powershell.msi