<# ================================================================================ AutomateSQL Enterprise Sandbox Engine - Pre-Flight Diagnostic Check Copyright (c) 2026 AutomateSQL LLC. All rights reserved. This pre-flight diagnostic script is provided free of charge for evaluating host system compatibility prior to enrollment. The full Enterprise Sandbox Engine codebase, automated Packer answer files, Vagrantfiles, and lesson runbooks are licensed exclusively for authorized AutomateSQL students and purchasers. Website: https://www.automatesql.com ================================================================================ .SYNOPSIS Pre-flight compatibility check for the Enterprise Sandbox Engine student lab. .DESCRIPTION Validates host hardware, BIOS virtualization, Hyper-V coexistence, RAM, disk space, and permissions to ensure the student's machine can successfully build and run the VMware Workstation + Vagrant lab. .PARAMETER SkipDiskCheck Skips the free disk space verification. .PARAMETER TargetDrive Drive letter to verify for free disk space (default: current drive). #> [CmdletBinding()] param( [switch]$SkipDiskCheck, [string]$TargetDrive ) if (-not $TargetDrive) { if ($PSScriptRoot -and $PSScriptRoot.Length -ge 1) { $TargetDrive = $PSScriptRoot.Substring(0, 1) } else { $TargetDrive = (Get-Location).Drive.Name } } $passColor = "Green" $warnColor = "Yellow" $failColor = "Red" $infoColor = "Cyan" $passCount = 0 $warnCount = 0 $failCount = 0 Write-Host "================================================================================" -ForegroundColor $infoColor Write-Host " Enterprise Sandbox Engine - Pre-Flight Check " -ForegroundColor $infoColor Write-Host "================================================================================" -ForegroundColor $infoColor Write-Host "" # ------------------------------------------------------------------------------ # 1. Administrator Privileges Check # ------------------------------------------------------------------------------ $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if ($isAdmin) { Write-Host "[ PASS ] Privileges: Administrator rights confirmed." -ForegroundColor $passColor $passCount++ } else { Write-Host "[ WARN ] Privileges: Running as Standard User." -ForegroundColor $warnColor Write-Host " * Note: Setup-HostEnvironment.ps1 will require elevation." -ForegroundColor $warnColor $warnCount++ } # ------------------------------------------------------------------------------ # 2. Operating System & Architecture Check # ------------------------------------------------------------------------------ $is64Bit = [Environment]::Is64BitOperatingSystem $os = Get-CimInstance Win32_OperatingSystem $osName = $os.Caption $osBuild = [int]$os.BuildNumber $procArch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE } $osArch = try { [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString() } catch { $procArch } if (-not $is64Bit) { Write-Host "[ FAIL ] Architecture: 32-bit OS detected. 64-bit Windows is required." -ForegroundColor $failColor $failCount++ } elseif ($procArch -match "ARM" -or $osArch -match "Arm") { Write-Host "[ FAIL ] Architecture: ARM64 detected. 64-bit Intel or AMD (x64) is required." -ForegroundColor $failColor Write-Host " * Note: VMware Workstation and the x86_64 lab VMs cannot run on ARM-based hardware (Snapdragon Copilot+ or Apple Silicon)." -ForegroundColor $failColor $failCount++ } elseif ($procArch -eq "AMD64" -or $osArch -eq "X64") { Write-Host "[ PASS ] Architecture: 64-bit x64 OS ($osName - Build $osBuild)" -ForegroundColor $passColor $passCount++ } else { Write-Host "[ FAIL ] Architecture: Unsupported processor architecture '$procArch'. 64-bit Intel or AMD (x64) is required." -ForegroundColor $failColor $failCount++ } # ------------------------------------------------------------------------------ # 3. CPU Virtualization (VT-x / AMD-V) in BIOS # ------------------------------------------------------------------------------ try { $proc = Get-CimInstance Win32_Processor | Select-Object -First 1 $cpuName = $proc.Name.Trim() $virtEnabled = $proc.VirtualizationFirmwareEnabled $hypervisorPresent = (Get-CimInstance Win32_ComputerSystem).HypervisorPresent if ($virtEnabled -eq $true) { Write-Host "[ PASS ] BIOS Virtualization (VT-x / AMD-V): Enabled ($cpuName)" -ForegroundColor $passColor $passCount++ } elseif ($hypervisorPresent -eq $true) { Write-Host "[ PASS ] BIOS Virtualization (VT-x / AMD-V): Enabled ($cpuName) [Active Hypervisor]" -ForegroundColor $passColor $passCount++ } elseif ($virtEnabled -eq $false) { Write-Host "[ FAIL ] BIOS Virtualization (VT-x / AMD-V): DISABLED in BIOS/UEFI." -ForegroundColor $failColor Write-Host " * Remediation: Reboot into BIOS/UEFI settings and enable Intel VT-x or AMD-V (SVM)." -ForegroundColor $failColor $failCount++ } else { Write-Host "[ INFO ] BIOS Virtualization: Checked ($cpuName)." -ForegroundColor $passColor $passCount++ } } catch { Write-Host "[ WARN ] Could not query CPU virtualization status: $_" -ForegroundColor $warnColor $warnCount++ } # ------------------------------------------------------------------------------ # 4. CPU Cores & Logical Processors # ------------------------------------------------------------------------------ $logicalCores = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors if ($logicalCores -ge 8) { Write-Host "[ PASS ] CPU Logical Cores: $logicalCores logical cores detected (Recommended: 8+)." -ForegroundColor $passColor $passCount++ } elseif ($logicalCores -ge 4) { Write-Host "[ WARN ] CPU Logical Cores: $logicalCores logical cores detected." -ForegroundColor $warnColor Write-Host " * Note: 8+ cores recommended for running 5 VMs simultaneously." -ForegroundColor $warnColor $warnCount++ } else { Write-Host "[ FAIL ] CPU Logical Cores: $logicalCores detected. At least 4 cores required." -ForegroundColor $failColor $failCount++ } # ------------------------------------------------------------------------------ # 5. Hyper-V & Hypervisor Conflict Check # ------------------------------------------------------------------------------ $hypervService = Get-Service -Name "vmms" -ErrorAction SilentlyContinue $hypervFeature = $null if ($isAdmin) { try { $hypervFeature = Get-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Hypervisor" -ErrorAction SilentlyContinue } catch {} } $bcdHypervisor = $null try { $bcdOutput = bcdedit /enum '{current}' 2>&1 $bcdHypervisor = ($bcdOutput | Select-String "hypervisorlaunchtype\s+(\w+)").Matches.Groups[1].Value } catch {} if (($hypervFeature -and $hypervFeature.State -eq 'Enabled') -or ($bcdHypervisor -eq 'Auto') -or ($hypervService -and $hypervService.Status -eq 'Running')) { Write-Host "[ WARN ] Hyper-V / Windows Hypervisor Platform is currently ACTIVE." -ForegroundColor $warnColor Write-Host " * VMware Workstation can coexist with Hyper-V via Windows Hypervisor Platform (WHP)," -ForegroundColor $warnColor Write-Host " but native nested virtualization performance is best with Hyper-V disabled." -ForegroundColor $warnColor Write-Host " * To disable if encountering performance or nested VM issues:" -ForegroundColor $warnColor Write-Host " Run as Admin: bcdedit /set hypervisorlaunchtype off (then reboot)" -ForegroundColor $warnColor $warnCount++ } else { Write-Host "[ PASS ] Hyper-V State: Standalone mode (Optimal for VMware Workstation Pro)." -ForegroundColor $passColor $passCount++ } # ------------------------------------------------------------------------------ # 6. Physical RAM (Memory) Check # ------------------------------------------------------------------------------ $totalRamBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory $totalRamGB = [math]::Round($totalRamBytes / 1GB, 1) if ($totalRamGB -ge 30) { Write-Host "[ PASS ] Physical Memory (RAM): $totalRamGB GB detected (Optimal for full 5-node lab)." -ForegroundColor $passColor $passCount++ } elseif ($totalRamGB -ge 15) { Write-Host "[ WARN ] Physical Memory (RAM): $totalRamGB GB detected." -ForegroundColor $warnColor Write-Host " * Note: Sufficient for box building and running 2-3 VMs at a time." -ForegroundColor $warnColor Write-Host " * Running all 5 VMs simultaneously requires 32 GB RAM." -ForegroundColor $warnColor $warnCount++ } else { Write-Host "[ FAIL ] Physical Memory (RAM): $totalRamGB GB detected. Minimum 16 GB required." -ForegroundColor $failColor $failCount++ } # ------------------------------------------------------------------------------ # 7. Free Disk Space Check # ------------------------------------------------------------------------------ if (-not $SkipDiskCheck) { try { $driveInfo = Get-PSDrive -Name $TargetDrive -ErrorAction Stop $freeSpaceGB = [math]::Round($driveInfo.Free / 1GB, 1) if ($freeSpaceGB -ge 150) { Write-Host "[ PASS ] Free Disk Space ($TargetDrive`:): $freeSpaceGB GB free (Recommended: 150+ GB)." -ForegroundColor $passColor $passCount++ } elseif ($freeSpaceGB -ge 100) { Write-Host "[ WARN ] Free Disk Space ($TargetDrive`:): $freeSpaceGB GB free." -ForegroundColor $warnColor Write-Host " * Note: Building boxes and running all 5 lab VMs requires ~150 GB." -ForegroundColor $warnColor $warnCount++ } else { Write-Host "[ FAIL ] Free Disk Space ($TargetDrive`:): $freeSpaceGB GB free. Minimum 100 GB required (150 GB recommended)." -ForegroundColor $failColor Write-Host " * Remediation: Free up disk space on drive $TargetDrive`: before proceeding." -ForegroundColor $failColor $failCount++ } } catch { Write-Host "[ WARN ] Could not determine free disk space for drive $TargetDrive`:" -ForegroundColor $warnColor $warnCount++ } } Write-Host "" Write-Host "--------------------------------------------------------------------------------" -ForegroundColor $infoColor Write-Host "Scorecard: [ $passCount Passed ] [ $warnCount Warnings ] [ $failCount Failed ]" -ForegroundColor $(if ($failCount -gt 0) { $failColor } elseif ($warnCount -gt 0) { $warnColor } else { $passColor }) Write-Host "--------------------------------------------------------------------------------" -ForegroundColor $infoColor if ($failCount -gt 0) { Write-Host "Result: PRE-FLIGHT CHECK FAILED. Please resolve the critical item(s) above." -ForegroundColor $failColor return $false } elseif ($warnCount -gt 0) { Write-Host "Result: PRE-FLIGHT CHECK PASSED WITH WARNINGS. Review the notes above before continuing." -ForegroundColor $warnColor return $true } else { Write-Host "Result: ALL PRE-FLIGHT CHECKS PASSED! Your system is ready." -ForegroundColor $passColor return $true }