You are on page 1of 4

DC Agent Uninstall GPO SCHEDULER Script (UEMS)

DC Agent Uninstall GPO

1. Download below files.

AgentUninstall.ps1
https://downloads.zohocorp.com/dnd/Endpoint_Central_MSP
/dNYEsqc574k6EBN/AgentUninstall.ps1

AgentCleanupTool.exe
https://downloads.zohocorp.com/dnd/Desktop_Central/fbX5
PXL30e49QSU/AgentCleanupTool.exe

2. Create a GPO to identify targets for deployment


● Open the Group Policy Management Console (GPMC) by
opening Run (Windows key + r) and typing gpmc.msc .

Once in the GPMC, right-click on your target


"organizational unit" (typically a domain), and select
Create a GPO in this domain, and Link it here option.

Enter a Name for the new GPO. For example,


"MEDC_agent_uninstall".

Once the new GPO is created, you can see it in the GPMC
in the left navigation pane, under Group Policy
Objects.
DC Agent Uninstall GPO SCHEDULER Script (UEMS)

4. Creating/Provisioning Network Share:


● Log on to the Windows Server machine as an
administrator.
● Open the Server Manager Console by selecting it
from the Administrative Tools menu.
● From the Server Manager Dashboard, select File and
Storage Services.
Now, open the Shares tab, select SYSVOL and click on
Open Share.

Create a scheduled task to execute the deployment and


DC Agent Uninstall GPO SCHEDULER Script (UEMS)

installation of the Windows Agent


● Open the Group Policy Management Editor by right-
clicking on the new GPO you created, and selecting
Edit.
● Expand Computer Configuration --> Policies -->
Windows Settings --> scripts(Startup/Shutdown)
● Right click Startup and click Properties and switch
to PowerShell Scripts.

● Click Show Files


● Drag and drop/Paste the below files to this
location and copy the location (\\Domain
name\SysVol\Domain
name\Policies\{ID}\Machine\Scripts\Startup) and
copy the location and close it.
○ AgentUninstall.ps1
○ AgentCleanUpTool.exe

● In the Startup Properties dialog box, click Add.
Browse and navigate to the location, copy the browsed
path (\\Domain name\SysVol\Domain
name\Policies\{ID}\Machine\Scripts\Startup) and select
the AgentUninstall.ps1 script. Then specify the path
(copied location) of the AgentUninstall.ps1 script and
the script arguments as mentioned below:

EXAMPLE:
Script Name:

\\domain.com\SysVol\domain.com\Policies\{id}\Machine\Sc
ripts\Startup\AgentUninstall.ps1
DC Agent Uninstall GPO SCHEDULER Script (UEMS)

**( replace
\\domain.com\SysVol\domain.com\Policies\{id}\Machine\Scripts\Sta
rtup with the network path you copied earlier.

\\<domain.com>\SYSVOL\<domain.com>\Policies\{id}\Machine\Scripts\St
artup\AgentUninstall.ps1 )

Script Parameters:
AgentCleanupTool.exe DC

8. Successfully created the GPO start-up policy. Click


Apply OK to close the Add a Script dialog box

12. The script will be executed when the client


computers reboot

Please remove the startup script policy after the


agents are uninstalled.

You might also like