@echo off REM ==================================================================== REM ConnectWise RMM Migration - Direct Execution REM For use with ScreenConnect - runs immediately REM ==================================================================== SET "New_Tenant_Agent_URL=%~1" SET TEMP_DIR=C:\Temp SET WORKER_URL=https://scripts.pembrix.com/rmm-migration/rmm-migration-worker.bat SET WORKER_SCRIPT=%TEMP_DIR%\rmm-migration-worker.bat if "%New_Tenant_Agent_URL%"=="" ( echo ERROR: URL parameter required exit /b 1 ) if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%" echo Downloading worker script... powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('%WORKER_URL%', '%WORKER_SCRIPT%')}" 2>nul if not exist "%WORKER_SCRIPT%" ( bitsadmin /transfer "WorkerDownload" /priority high "%WORKER_URL%" "%WORKER_SCRIPT%" >nul 2>&1 ) if not exist "%WORKER_SCRIPT%" ( echo ERROR: Failed to download worker script exit /b 1 ) echo Executing migration... call "%WORKER_SCRIPT%" "%New_Tenant_Agent_URL%" exit /b %errorLevel%