Uninstalling the agent using a script (MDM)
This task explains how to uninstall the SmartEdge Agent from Windows endpoints using a PowerShell script deployed through an MDM solution. The uninstall runs silently and does not require user interaction.
- Script: Download
Remove-SmartEdgeAgent.ps1script from here. - Supported SmartEdge Agent all versions: 1.x, 2.x, and 3.x
- Supported operating systems: Windows 10 and Windows 11 (x64)
- Required privileges: Administrator or SYSTEM
The following procedures describe how to deploy Remove-SmartEdgeAgent.ps1 using supported MDM solutions. Select the method that matches your organization's deployment
platform.
Microsoft Intune
- Upload
Remove-SmartEdgeAgent.ps1as a Windows PowerShell platform script. - Configure the following script settings:
Table 1. Setting Value Run this script using the logged-on credentials No Run script in 64-bit PowerShell host Yes - Save the script and assign it to the required device group.
No additional wrapper or configuration is required. Once assigned, Intune deploys the script silently to all devices in the group. See the Exit codes section below to verify the result.
SCCM / Configuration Manager
- Create a Package and Program in SCCM.
- Configure the program by using the following command line:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File Remove-SmartEdgeAgent.ps1 -Force - Set the program to run with the following settings:
Table 2. Setting Value Run Hidden Run whether or not a user is logged on Enabled - Configure the program to allow the following return codes:
Table 3. Code Description 0 Success 3010 Soft reboot required
Once the program runs, SCCM reports the exit code against the device's record. See the Exit codes section below to verify the result.
Group Policy (Startup Script)
- Copy
Remove-SmartEdgeAgent.ps1to a network share that is accessible by computer accounts, for example:\\<domain>\NETLOGON\SEA_Removal\. - Configure a Computer Startup Script (PowerShell) with the following settings:
Table 4. Setting Value Script \\<domain>\NETLOGON\SEA_Removal\Remove-SmartEdgeAgent.ps1Parameters -Force -LogPath \\<domain>\NETLOGON\SEA_Removal\Logs - Ensure the script runs in the computer context so that it executes the required privileges.
The script runs at the next device startup. See the Exit codes section below to verify the result.
Ivanti or other MDM solutions
- Create a silent deployment package using the following command
line:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ".\Remove-SmartEdgeAgent.ps1" -Force - Ensure the script runs in the SYSTEM context or with elevated administrator privileges.
Once deployed, the MDM solution reports the exit code against the device's record. See the Exit codes section below to verify the result.
Manual (single endpoint)
- Open PowerShell as Administrator.
- Allow script execution for the current session:
Set-ExecutionPolicy Bypass -Scope Process -Force - Run the uninstall script:
.\Remove-SmartEdgeAgent.ps1 -Force -Verbose
The script runs immediately and logs the result to the default log location. See the Exit codes section below to verify the result.
Logging
SEA_Removal_<COMPUTERNAME>_<YYYYMMDD_HHMMSS>.logC:\ProgramData\Forcepoint\SEA_Removal_Logs\-LogPath
parameter:powershell.exe -NoProfile -ExecutionPolicy Bypass -File Remove-SmartEdgeAgent.ps1 -Force -LogPath "\\fileserver\IT\SEA_Logs"[2026-04-15 02:11:21.076] [INFO] PHASE 2: Stop and Remove Services
[2026-04-15 02:11:21.173] [INFO] Stopping service: bgSmartEdge (Status: Running)
[2026-04-15 02:11:28.503] [INFO] sc.exe delete result: [SC] DeleteService SUCCESSEvery action is recorded with a timestamp and severity level: INFO, WARNING, or ERROR.
Exit codes
| Exit code | Description | Recommended action |
|---|---|---|
| 0 | The agent was removed successfully. No artifacts remain. | Mark the deployment as successful. |
| 3010 | Removal is complete. A reboot is required to finish cleanup of locked files or driver objects. | Schedule a reboot, then optionally re-run the script to verify. |
| 12 | Removal is incomplete. Some components could not be removed. | Reboot the device and re-run the script. |
| 740 | Script did not run with administrator privileges. | Update the deployment to run as SYSTEM or elevated administrator. |