#................................... # Check .Net Framework installed if (Test-Path -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") { if (((Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version).Substring(0,4) -eq "4.0.") { Write-Host "Not installed" -Forgroundcolor Red } else { $dotnet40 = $false switch ((Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Release) { 378389 { Write-Host ".NET Framework 4.5 installed on this computer" -ForegroundColor Red} 378675 { Write-Host ".NET Framework 4.5.1 installed on this computer" -ForegroundColor Red} 378758 { Write-Host ".NET Framework 4.5.1 installed on this computer" -ForegroundColor Red} 379893 { Write-Host ".NET Framework 4.5.2 installed on this computer" -ForegroundColor Red} 393295 { Write-Host ".NET Framework 4.6 installed on this computer" -ForegroundColor Red} 393297 { Write-Host ".NET Framework 4.6 installed on this computer" -ForegroundColor Red} 394254 { Write-Host ".NET Framework 4.6.1 installed on this computer" -ForegroundColor Red} 394271 { Write-Host ".NET Framework 4.6.1 installed on this computer" -ForegroundColor Red} 394802 { Write-Host ".NET Framework 4.6.2 installed on this computer" -ForegroundColor Red} 394806 { Write-Host ".NET Framework 4.6.2 installed on this computer" -ForegroundColor Red} 460798 { Write-Host ".NET Framework 4.7 installed on this computer" -ForegroundColor Red} 460805 { Write-Host ".NET Framework 4.7 installed on this computer" -ForegroundColor Red} 461308 { Write-Host ".NET Framework 4.7.1 installed on this computer" -ForegroundColor Green} 461310 { Write-Host ".NET Framework 4.7.1 installed on this computer" -ForegroundColor Green} 461808 { Write-Host ".NET Framework 4.7.2 installed on this computer" -ForegroundColor Green} 461814 { Write-Host ".NET Framework 4.7.2 installed on this computer" -ForegroundColor Green} default { Write-Host ".NET Framework 4.7.2 or later installed on this computer" -ForegroundColor Green} } } } #........................................... # Check Powershell version: $PSVersionClean = $PSVersionTable.PSVersion.ToString() if ($PSVersionTable.PSVersion.Major -lt 4) { $PSVersionOK = $false Write-Host "PowerShell version is $PSVersionClean" -Foregroundcolor Red } else { $PSVersionOK = $true Write-Host "PowerShell version is $PSVersionClean" -Foregroundcolor Green } #................................... # Execution Policy #................................... $executionPolicy = &"$env:WINDIR\syswow64\windowspowershell\v1.0\powershell.exe" "Get-executionPolicy" if ($executionPolicy -eq "Restricted") { Write-Host "Execution Policy is set to Restricted" -ForegroundColor Red } if ($executionPolicy -eq "RemoteSigned") { Write-Host "Execution Policy is set to Remotesigned" -ForegroundColor Green } if ($executionPolicy -eq "Unrestricted") { Write-Host "Execution Policy is set to Unrestricted" -ForegroundColor Green } #....................................................... # Microsoft Visual C++ 2015 Redistributable 2015 X86 #......................................................... if (((Get-ItemProperty -Path "HKLM:SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X86" -ErrorAction SilentlyContinue).Version) -eq "v14.0.23026.00") { Write-Host "Visual C++ 2015 Redistributable X86 is installed " -ForegroundColor Green } else { $LocalTempDir = $env:TEMP; $VcppInstaller = "VcppInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe', "$LocalTempDir\$VcppInstaller"); & "$LocalTempDir\$VcppInstaller" /silent /install; $Process2Monitor = "VcppInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$VcppInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound) } Read-host "Press Any Key to close"