# Install, Uninstall & Migrate Agents with a GPO Tool Windows GPO is a powerful and versatile tool. Agent can be **installed, uninstalled or migrated** using the GPO light-weight tool. ## Advantages - The GPO Lightweight Tool is a simple and user-friendly tool for configuring Group Policy Objects (GPO) to deploy agent installations, whether through startup processes or scheduled tasks. - It also allows to uninstall/re-install agents through GPO without complexity on configuring the GPO. ## Disadvantages - The disadvantages of the GPO startup script and scheduled task methods are inherited. **Note:** - The GPO lightweight tool only supports .exe files and does not support .MSI files. - Kindly use account with Domain Admin credentials. - If a new GPO policy is applied, the installation for existing installed agents will be skipped on all machines. The remaining agents will be installed according to the new policy. This applies to Installation policies. A Migration policy runs the Cleanup Tool and the agent installer on all computers linked to the policy, including computers where the agent is already installed, unless they are excluded. - The agent installer added to the tool is installed on the computers as it is. An installer downloaded earlier may be of an older version, and an agent installed from an older installer does not upgrade automatically. Follow the steps given below to create a Group policy and link it with OUs and Domains: ## Steps ### 1. Select the account details - Open the Domain Controller of the required AD in which the GPO needs to be configured. - To download the GPO tool for build version [old version here], click [here](https://workdrive.zohoexternal.in/external/8551ff5c2caefe41cfbf2f0cdcf2ea12c00c7bea9862ac9815f0634fa3b685c2/download?directDownload=true). - To download the GPO tool for build version [new version here], click [here](https://workdrive.zohoexternal.in/external/b24bbf373f7dc6e2a37636893b7c768c7fef7daf73736b4f3edc896e4e8faa5d/download?directDownload=true). - Execute the Tool As an administrator. - Select "**Continue with above details**" and click next. ![GPO tool showing auto-fetched account details with 'Continue with above details' selected](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo1.webp) - If you encounter an error in fetching the domain or domain controller name or if you would like to execute the tool from another machine instead of the domain controller machine, select the **enter details manually** option. Kindly use account with domain admin credentials privilege. ![Entering the domain and domain controller details manually in the GPO tool](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo2.webp) **To get the domain or OU Distinguished name, follow these steps:** - Under Administrative tools, open the active directory users and computers. ![Opening Active Directory Users and Computers from Administrative Tools](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo3.webp) - Under View, enable Advanced Features. ![Enabling Advanced Features under the View menu](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo4.webp) - Right click on the OU / Domain and Select Properties -> Attribute Editor -> distinguishedName -> View. ![Viewing the distinguishedName attribute from the OU or Domain properties Attribute Editor](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo5.webp) - A GPO can be linked only to an Organizational Unit or to the domain. It cannot be linked to default containers such as Computers, Users or Builtin. For computers in a default container, select **Entire Domain** in the Link the GPO step. ### 2. Choose the required action - Select the required action **(Installation \ Uninstallation \Migration)**. ![Selecting the required action — Installation, Uninstallation, or Migration](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo6.webp) **If you choose installation, for the agent installer .exe, follow these steps:** - Open the server web console. - Navigate to **Agent -> Scope of Management -> Computers**. - Under the **Managed Computers** tab, click **Bulk Installation**. You can also click **Download Agent** and then select the **Bulk agent install** link. To learn how to fill in the agent and deployment details on this screen, see Bulk agent installation using a deployment token. - Click **Download Agent**. A .zip file is downloaded. - Copy the **Deployment Token**. - Extract the .zip file. It contains the agent installer .exe and DCAgentServerInfo.json. **Note:** If your Endpoint Central server is on a build version lower than [Insert Build Number], the agent will download as a single .exe. In this case, you will not have or need the DCAgentServerInfo.json file. In the GPO tool, click **Select** next to Agent Installer .exe and choose the downloaded .exe. - In the GPO tool, click **Select** next to Agent Installer .exe and choose the extracted .exe. - Click Select next to DCAgentServerInfo.json and choose the extracted JSON file. - Paste the copied Deployment Token in the **Bulk Install Token** field. - Click Next. **Note:** If your Endpoint Central server is on a build version lower than [Insert Deployment Token Build Number], navigate to **Agent -> Computers**, select the required remote office, choose the Windows OS Platform, and click **Download Agent**. ![Downloading the agent installer from Agent > Computers and adding it to the tool](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo7.webp) If the domain has multiple remote offices with Distribution Servers, select the **Local Office** agent and configure IPSCOPE under **Agent -> Settings -> IP SCOPE**. The computers are then moved to the correct remote office automatically, based on their IP address. For details, see [Managing roaming users](https://www.manageengine.com/products/desktop-central/help/device-onboarding/managing_computers_of_roaming_users.html). **If you choose uninstallation** use the **AgentCleanupToolClient.exe**. Follow the steps given in this [document](https://www.manageengine.com/products/desktop-central/help/device-onboarding/how-to-uninstall-agent-using-agentcleanup-tool.html) to generate the Cleanup tool. ![Adding AgentCleanupToolClient.exe for the uninstallation action](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo13.webp) **If you choose migration**, use **Agent Installer exe and AgentCleanupToolClient.exe**. Follow the steps given in this [document](https://www.manageengine.com/products/desktop-central/help/device-onboarding/how-to-uninstall-agent-using-agentcleanup-tool.html) to generate the Cleanup tool. ![Adding the agent installer and AgentCleanupToolClient.exe for the migration action](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo12.webp) For the **agent installer .exe,** follow these steps: - Open the server web console. - Navigate to **Agent -> Scope of Management -> Computers**. - Under the **Managed Computers** tab, click **Bulk Installation**. You can also click **Download Agent** and then select the **Bulk agent install** link. To learn how to fill in the agent and deployment details on this screen, see Bulk agent installation using a deployment token. - Click **Download Agent** and extract the downloaded .zip file. - Copy the **Deployment Token**. **Note:** If your Endpoint Central server is on a build version lower than [Insert Build Number], the agent will download as a single .exe. In this case, you will not have or need the DCAgentServerInfo.json file. In the GPO tool, select the downloaded .exe in Agent Installer .exe. - In the GPO tool, select the extracted .exe in Agent Installer .exe, the extracted JSON file in DCAgentServerInfo.json, and the Cleanup tool in AgentCleanupToolClient. - Paste the copied Deployment Token in the **Bulk Install Token** field. - Click Next. **Note:** If your Endpoint Central server is on a build version lower than [Insert Deployment Token Build Number], navigate to **Agent -> Computers**, select the required remote office, choose the Windows OS Platform, and click **Download Agent**. ### 3. Choose the Policy details - **Enter the Name of the GPO** [eg : MEECAgentInstall] -> **Enter the policy type** [Startup or scheduler] -> **Select the Script type** [powershell script is always recommended]. ![Entering the GPO name, policy type, and script type](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo8.webp) **Example:** ```powershell -ExecutionPolicy Bypass -File "\\DCNAME.zoho.com\SYSVOL\zoho.com\scripts\agent_reinstallation\InstallAgent.ps1" -BulkInstallToken "ABC123XYZ" ``` **Note:** The `-BulkInstallToken` value in the PowerShell script is the Deployment Token you copied from the **Bulk Installation** screen. ### 4. Link the GPO - To apply policy to entire domain, select "**Entire Domain**". - To apply the policy to a **specific OU**, enter the OU distinguished names and click next. (To obtain the OU distinguished name, refer to the first step.) ![Linking the GPO to the entire domain or a specific OU](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo9.webp) ### 5. Confirm the details - Confirm the policy details and click next. - The policy has been successfully created. ![Confirming the policy details, showing the policy created successfully](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo10.webp) **Note:** If the start up policy is configured, restart the endpoints and check the status and if the scheduler policy is created it will be applied in the endpoints based on the GPO configuration in your environment. To apply it immediately, use `gpupdate /force` as given below. **To test the policy in a machine Immediately after creation, follow the steps below:** - Open the **client machine -> Command prompt** as an admin and execute the command **gpupdate /force**. ![Running gpupdate /force in an administrator command prompt on the client machine](https://cdn.manageengine.com/sites/meweb/images/malware-protection/help/device-onboarding/gpo11.webp) - Once the policy update is completed restart the machine if the "**Start-up**" policy is configured. - For "**Immediate Task**" policy will be applied once the policy update is completed. Listed below are a few possible issues that can be encountered during agent installation, and resolution steps for the same. - [Access is denied](https://www.manageengine.com/malware-protection/help/device-onboarding/agent_installation_access_denied.html) - [The network path was not found](https://www.manageengine.com/malware-protection/help/device-onboarding/agent_installation_failure_path.html) - [Logon Failure: Unknown user name or password](https://www.manageengine.com/malware-protection/help/device-onboarding/agent_installation_logon_failure.html) - [No Network provider accepted the given Network Path](https://www.manageengine.com/malware-protection/help/device-onboarding/agent_installation_network_provider.html) - [Not enough server storage is available to process this command](https://www.manageengine.com/malware-protection/help/device-onboarding/agent_installation_failure_storage.html)