Add persistent desktop supervisor for ERP Local Agent

This commit is contained in:
A R R R Associates
2026-08-20 20:01:59 +05:30
parent f7ebd32597
commit de8b32b06d
14 changed files with 707 additions and 72 deletions
@@ -1,3 +1,5 @@
@echo off
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Unregister-ScheduledTask -TaskName 'ERP Local Agent' -Confirm:$false -ErrorAction SilentlyContinue; Unregister-ScheduledTask -TaskName 'AuditFirmStorageAgent' -Confirm:$false -ErrorAction SilentlyContinue"
@echo off
setlocal
set "AGENT_DIR=%~dp0"
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$root=$env:AGENT_DIR.TrimEnd('\'); try { Stop-ScheduledTask -TaskName 'ERP Local Agent' -ErrorAction SilentlyContinue } catch {}; try { Unregister-ScheduledTask -TaskName 'ERP Local Agent' -Confirm:$false -ErrorAction SilentlyContinue } catch {}; Get-CimInstance Win32_Process -ErrorAction SilentlyContinue | Where-Object { $_.CommandLine -and (($_.CommandLine -match 'ERPAgentSupervisor\.pyw') -or ($_.CommandLine -match 'erp_local_agent\.main')) -and $_.CommandLine -like ('*'+$root+'*') } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"
pause