# Build a standalone Windows exe (no Python install needed on target PCs). # Output: host\dist\send_sysinfo.exe $ErrorActionPreference = "Stop" $here = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $here $pyCandidates = @( "python", (Join-Path $env:USERPROFILE "AppData\Local\Programs\Python\Python312\python.exe"), (Join-Path $env:USERPROFILE "AppData\Local\Programs\Python\Python311\python.exe") ) $py = $null foreach ($c in $pyCandidates) { $cmd = Get-Command $c -ErrorAction SilentlyContinue if ($cmd) { $py = $cmd.Source; break } if (Test-Path $c) { $py = $c; break } } if (-not $py) { throw "Python required only on the build machine." } & $py -m pip install -q pyinstaller psutil pyserial nvidia-ml-py & $py -m PyInstaller --noconfirm --clean --onefile --console ` --name send_sysinfo ` --hidden-import serial.tools.list_ports ` --hidden-import psutil ` --collect-all nvidia_ml_py ` .\send_sysinfo.py if (-not (Test-Path ".\dist\send_sysinfo.exe")) { throw "Build failed: dist\send_sysinfo.exe missing" } Copy-Item ".\dist\send_sysinfo.exe" ".\send_sysinfo.exe" -Force Write-Host "OK -> $here\send_sysinfo.exe" Write-Host "Also -> $here\dist\send_sysinfo.exe"