@echo off
:: Created by: Ionut (Mike) Dutan
:: Created on: December 1, 2022
:: Updated on: March 14, 2023
:: Version: Revision 4
:: Opening CMD maximized
if not "%1" == "max" start /MAX cmd /c %0 max & exit/b\
echo *************************** Workspace ONE Intelligent Hub removal process ***************************
:: Prompt to Run as administrator
Set "Variable=0" & if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
fsutil dirty query %systemdrive% >nul 2>&1 && goto :(Privileges_got)
If "%1"=="%Variable%" (echo. &echo. Please right-click on the file and select &echo. "Run as administrator". &echo. Press any key to exit. &pause>nul 2>&1& exit)
cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%Variable%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" & exit
:(Privileges_got)
:: Checking Bitlocker status
echo 1. Checking Bitlocker status
for /f %%i in ('powershell -command "Get-BitLockerVolume -MountPoint C: | Select-Object -ExpandProperty EncryptionMethod"') do set VAR=%%i
echo %VAR%
if "%VAR%"=="None" (
GOTO :NotEncrypted
) ELSE (
GOTO :Encrypted
)
:Encrypted
echo.
echo Detected drive encryption method is "%VAR%"
echo.
echo Your drive is Encrypted with Bitlocker. Please remove the Encryption profile from EMM and start decryption.
echo.
echo Setup will exit now
echo.
timeout 10
exit
:NotEncrypted
echo.
echo Detected drive encryption method is "%VAR%"
echo.
echo Your drive is not Encrypted. Process can continue further
echo.
pause
echo.
:: Removing WS1 Scheduled Tasks
echo 2. Removing WS1 Scheduled Tasks
schtasks /delete /tn "Airwatch" /f
schtasks /delete /tn "IntelligentHubUninstaller" /f
schtasks /delete /tn "VMwareHubHealthMonitoringJob" /f
schtasks /delete /tn "PostOOBEPhase18hours" /f
schtasks /delete /tn "PostOOBEPhase1logon" /f
schtasks /delete /tn "PostOOBEPhase1Unlock" /f
schtasks /delete /tn "VMWare\SfdAgent\Check Required Apps" /f
schtasks /delete /tn "VMWare\SfdAgent\Install Validation Task" /f
schtasks /delete /tn "VMWare\SfdAgent\Software Distribution Queue Task" /f
echo Done.
echo.
:: Checking and Stopping the running WS1 processes
echo 3. Checking and Stopping the running WS1 processes
tasklist /FI "IMAGENAME eq AwWindowsIpc.exe" 2>NUL | find /I /N "AwWindowsIpc.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /f /im AwWindowsIpc.exe
tasklist /FI "IMAGENAME eq AWProcessCommands.exe" 2>NUL | find /I /N "AWProcessCommands.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /f /im AWProcessCommands.exe
echo Done.
echo.
:: Uninstalling Workspace ONE Intelligent Hub
echo 4. Uninstalling Workspace ONE Intelligent Hub
powershell -Command "Get-AppxPackage AirWatchLLC.WorkspaceONEIntelligentHub | Remove-AppxPackage"
echo Done.
echo.
:: Uninstalling Workspace ONE Intelligent Hub Installer
echo 5. Uninstalling Workspace ONE Intelligent Hub Installer
wmic product where name="Workspace ONE Intelligent Hub Installer" call uninstall /nointeractive
echo Done.
echo.
:: Checking & Stopping WS1 Oracle uninstall script and removing its leftovers
echo 6. Checking and Stopping WS1 Oracle uninstall script and removing its leftovers
tasklist /FI "IMAGENAME eq powershell.exe" 2>NUL | find /I /N "powershell.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /f /im powershell.exe
if exist "%programfiles(x86)%\Airwatch" (
takeown /f "%programfiles(x86)%\Airwatch"
attrib -r -s -h /s /d "%programfiles(x86)%\Airwatch"
rmdir /s /q "%programfiles(x86)%\Airwatch"
)
echo Done.
echo.
:: Stopping AirwatchService
echo 7. Stopping AirwatchService
net stop Airwatch
echo.
:: Removing Registry leftovers
echo 8. Checking and Removing WS1 Registry leftovers
reg delete "HKLM\SOFTWARE\Airwatch" /f
reg delete "HKLM\SOFTWARE\AirwatchMDM" /f
reg delete "HKLM\SOFTWARE\Microsoft\Enrollments" /f
reg delete "HKLM\SOFTWARE\Microsoft\EnterpriseDesktopAppManagement" /f
reg delete "HKLM\SOFTWARE\Microsoft\EnterpriseResourceManager\Tracked" /f
reg delete "HKLM\SOFTWARE\Provisioning\OMADM\Accounts" /f
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\WorkspaceONEIntelligentHub" /f
reg delete "HKLM\System\Currentcontrolset\Services\AirWatchService" /f
echo Done.
echo.
:: Removing WS1 leftovers from System folders
echo 9. Checking and Removing WS1 leftovers from System folders
if exist "%programdata%\Airwatch" (
takeown /f "%programdata%\Airwatch"
attrib -r -s -h /s /d "%programdata%\Airwatch"
rmdir /s /q "%programdata%\Airwatch"
)
if exist "%programdata%\AirWatchMDM" (
takeown /f "%programdata%\AirWatchMDM"
attrib -r -s -h /s /d "%programdata%\AirWatchMDM"
rmdir /s /q "%programdata%\AirWatchMDM"
)
if exist "%programdata%\Packages\AirWatchLLC.WorkspaceONEIntelligentHub_htcwkw4rx2gx4" (
takeown /f "%programdata%\Packages\AirWatchLLC.WorkspaceONEIntelligentHub_htcwkw4rx2gx4"
attrib -r -s -h /s /d "%programdata%\Packages\AirWatchLLC.WorkspaceONEIntelligentHub_htcwkw4rx2gx4"
rmdir /s /q "%programdata%\Packages\AirWatchLLC.WorkspaceONEIntelligentHub_htcwkw4rx2gx4"
)
if exist "%systemroot%\system32\AirWatchMDM.dll" (
takeown /f "%systemroot%\system32\AirWatchMDM.dll"
attrib -r -s -h /s /d "%systemroot%\system32\AirWatchMDM.dll"
del "%systemroot%\system32\AirWatchMDM.dll"
)
echo Done.
echo.
:: Restart computer
:: cls
echo It is required to restart the computer to finish the WS1 removal process.
echo.
echo Please save and close anything open now, before the computer is restarted.
echo.
pause
echo.
echo.
echo.
echo *** Restart computer now. ***
echo.
pause
shutdown /r /f /t 0