# WEVAL Sentinel Auto-Updater — runs silently # Place in Startup folder or call from existing sentinel $src = "$PSScriptRoot\products\weval-sentinel-agent.ps1" $dst = "C:\ProgramData\WEVAL\sentinel-agent.ps1" if (Test-Path $src) { $srcHash = (Get-FileHash $src -Algorithm MD5).Hash $dstHash = if (Test-Path $dst) { (Get-FileHash $dst -Algorithm MD5).Hash } else { "" } if ($srcHash -ne $dstHash) { # New version detected — upgrade Get-Process powershell | Where-Object { $_.MainWindowTitle -like "*Sentinel*" } | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 Copy-Item $src $dst -Force # Create scheduled task schtasks /Delete /TN "WEVAL Sentinel" /F 2>$null schtasks /Create /TN "WEVAL Sentinel" /TR "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File $dst" /SC ONLOGON /RL HIGHEST /F 2>$null # Start Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File `"$dst`"" -WindowStyle Hidden Add-Content "C:\ProgramData\WEVAL\sentinel.log" "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') | AUTO-UPDATED to v2.0" } }