@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b

echo ####### %0 #######

echo LEAVING domain ...
powershell -Command "Remove-Computer -Restart -PassThru -UnJoinDomainCredential $env:username -Confirm:$false -Force:$true"

echo ####### %0 #######