diff --git a/additional-install.ps1 b/additional-install.ps1 index ce02450..d92e3ab 100644 --- a/additional-install.ps1 +++ b/additional-install.ps1 @@ -6,7 +6,6 @@ } #Install Choco AddToSTatus "Install Choco" -$ENV:chocolateyVersion = "1.4.0" Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) choco feature enable -n allowGlobalConfirmation diff --git a/initialize.ps1 b/initialize.ps1 index a9a4284..194c439 100644 --- a/initialize.ps1 +++ b/initialize.ps1 @@ -385,6 +385,18 @@ if ($organization -ne "" -and $token -ne "" -and $pool -ne "" -and $agentUrl -ne } } +try { + $version = [System.Version](Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name 'Version') + if ($version -lt '4.8.0') { + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest -UseBasicParsing -uri 'https://go.microsoft.com/fwlink/?linkid=2088631' -OutFile 'C:\DEMO\dotnet48.exe' + & 'C:\DEMO\dotnet48.exe' /q /norestart + } +} +catch { + throw ".NET Framework 4.7 or higher doesn't seem to be installed" +} + $startupAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -WindowStyle Hidden -ExecutionPolicy UnRestricted -File $setupStartScript" $startupTrigger = New-ScheduledTaskTrigger -AtStartup $startupTrigger.Delay = "PT1M"