|
| 1 | +# Check if .NET Framework 4.8 is installed |
| 2 | +function Check-DotNetFramework { |
| 3 | + Write-Host "Checking for .NET Framework 4.8..." |
| 4 | + $registryPath = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" |
| 5 | + if (Test-Path $registryPath) { |
| 6 | + $releaseKey = Get-ItemProperty -Path $registryPath | Select-Object -ExpandProperty Release |
| 7 | + if ($releaseKey -ge 528040) { |
| 8 | + Write-Host ".NET Framework 4.8 is installed." -ForegroundColor Green |
| 9 | + return $true |
| 10 | + } else { |
| 11 | + Write-Host ".NET Framework 4.8 is NOT installed." -ForegroundColor Red |
| 12 | + return $false |
| 13 | + } |
| 14 | + } else { |
| 15 | + Write-Host ".NET Framework 4.8 is NOT installed." -ForegroundColor Red |
| 16 | + return $false |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +# Check if .NET 8.0 is installed |
| 21 | +function Check-DotNet8 { |
| 22 | + Write-Host "Checking for .NET 8.0 SDK..." |
| 23 | + $dotnetInfo = & dotnet --list-sdks 2>$null |
| 24 | + if ($dotnetInfo -match "^8\.0\.\d+") { |
| 25 | + Write-Host ".NET 8.0 SDK is installed." -ForegroundColor Green |
| 26 | + return $true |
| 27 | + } else { |
| 28 | + Write-Host ".NET 8.0 SDK is NOT installed." -ForegroundColor Red |
| 29 | + return $false |
| 30 | + } |
| 31 | +} |
| 32 | + |
| 33 | +# Main installation process |
| 34 | +function Start-Installation { |
| 35 | + $frameworkInstalled = Check-DotNetFramework |
| 36 | + $dotnet8Installed = Check-DotNet8 |
| 37 | + |
| 38 | + if (-not $frameworkInstalled -or -not $dotnet8Installed) { |
| 39 | + Write-Host "Some prerequisites are missing. Please install them and rerun this script." -ForegroundColor Yellow |
| 40 | + if (-not $frameworkInstalled) { |
| 41 | + Write-Host "Install .NET Framework 4.8 from: https://dotnet.microsoft.com/en-us/download/dotnet-framework" -ForegroundColor Yellow |
| 42 | + } |
| 43 | + if (-not $dotnet8Installed) { |
| 44 | + Write-Host "Install .NET 8.0 SDK from: https://dotnet.microsoft.com/en-us/download/dotnet" -ForegroundColor Yellow |
| 45 | + } |
| 46 | + exit 1 |
| 47 | + } |
| 48 | + |
| 49 | + Write-Host "All prerequisites are installed. Proceeding with the installation..." -ForegroundColor Green |
| 50 | + |
| 51 | + # Your AppControl installation commands go here |
| 52 | + # Example: |
| 53 | + # Write-Host "Installing AppControl..." |
| 54 | +} |
| 55 | + |
| 56 | +# Start the script |
| 57 | +Start-Installation |
| 58 | + |
| 59 | + |
1 | 60 | # Enable TLSv1.2 for compatibility with older clients
|
2 | 61 | [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
3 | 62 |
|
|
0 commit comments