Private/Install-PreRequisites.ps1
function Install-PreReqs { Write-Host "Checking prerequisites" try { Invoke-InstallPreRequisites $global:devops_configFile.PreReqsComplete = "True" } catch { Write-Host $_ $global:devops_configFile.PreReqsComplete = "Error" pause } $global:devops_configFile | ConvertTo-Json | Out-FileUtf8NoBom ("$env:APPDATA\Capgemini.PowerPlatform.DevOps\devopsConfig.json") } function Invoke-InstallPreRequisites { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $ProgressPreference = 'SilentlyContinue' if (!$env:ChocolateyInstall -or !(Test-Path $env:ChocolateyInstall\choco.exe)) { Write-Host "The ChocolateyInstall environment variable was not found. `n Chocolatey is not detected as installed. Installing..." Write-Warning "Are you running Powershell as an Administrator? If not, please close Powershell now and retry the installation with Powershell running as Administrator, so the chocolatey install does not fail." pause Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) } choco upgrade chocolatey -y Write-Host "Installing Git ..." choco upgrade git.install -y Write-Host "Installing NodeJS ..." choco upgrade nodejs-lts -y Write-Host "Installing Azure CLI ..." choco upgrade azure-cli -y Write-Host "Installing dotnet CLI ..." choco upgrade dotnetcore -y Write-Host "Installing nano ..." set-alias nano 'C:\Program Files\Git\usr\bin\nano.exe' Restart-PowerShell ## Install Azure DevOps Extension Write-Host "Installing azure-devops extension" az extension add --name azure-devops az extension update --name azure-devops if (!(Test-Path "$env:APPDATA\Capgemini.PowerPlatform.DevOps")) { New-Item -Path "$env:APPDATA\Capgemini.PowerPlatform.DevOps" -ItemType Directory } if (!(Test-Path "$env:APPDATA\Capgemini.PowerPlatform.DevOps\devopsConfig.json")) { Copy-Item (Join-Path $PSScriptRoot "..\devopsConfig.json") -Destination "$env:APPDATA\Capgemini.PowerPlatform.DevOps\devopsConfig.json" } $global:devops_configFile = Get-Content ("$env:APPDATA\Capgemini.PowerPlatform.DevOps\devopsConfig.json") | ConvertFrom-Json $global:devops_configFile.PreReqsComplete = "True" $global:devops_configFile | ConvertTo-Json | Out-FileUtf8NoBom ("$env:APPDATA\Capgemini.PowerPlatform.DevOps\devopsConfig.json") } function Restart-PowerShell { Start-Sleep -Seconds 5 refreshenv $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") if (!$VerbosePreference -eq "Continue") { Clear-Host } } |