# Installing OpManager agent on devices using Startup script OpManager agent can be installed on multiple devices using Windows GPO. You can use startup scripts to deploy agent installation automatically during system startup, ensuring a consistent and hassle-free installation across all targeted devices. This method is ideal for large environments where centralized, automated deployment is required. **Note:** Ensure that the network has a domain-based setup and not a workgroup-based setup. You can even map the script to include the entire domain even if you have the OpManager agent installed only in a few devices, as the agent will be installed only in devices that don't have the agent installed already. 1. In the OpManager web console, go to **Settings → Discovery → Deploy Agent**. 2. Click on the **"Download"** button to get the OpManager Agent zip file. Extract the zip file and paste the extracted **OpManagerAgent.msi** and **OPMAgentServerInfo.json** files in the local directory. **NOTE:** It is mandatory to download a fresh copy of the OpManagerAgent.zip file and use the files within it for the installation process. 3. Identify the parent domain server(s) for the client computers, and copy the extracted **OpManagerAgent.msi** and **OPMAgentServerInfo.json** files to that domain server(s). 4. In the AD server, click on **Start → Run**. 5. Enter **gpmc.msc** and click **Okay**. 6. Right-click on the domain, and select **Create and link a GPO here**. ![OpManager agent installation on devices using startup script: Create and link a new GPO window](https://www.manageengine.com/network-monitoring/help/images/agent-create-and-link-gpo.jpg) 7. Specify a name for the GPO. 8. Select the GPO. **Note:** These steps need to be followed if you wish to install agents in a select few devices (refer this [image](https://www.manageengine.com/network-monitoring/help/images/agent-gpo-select-devices.jpg)). Do not follow these steps if you want to install agents in all the devices. - Click on the **Scope** tab. - Under **Security Filtering** section, click **Add**. - In the **Select User, Computer, or Group** dialog box, click **Object Types**. - Select specific computer object types, and click **"Okay"**. - Specify the computer names, and click **"Okay"**. - Finally, click on **Check Names** and then click **"Okay"** again. 9. Right-click the GPO and click on **"Edit"**. 10. For executing **VBScript**, follow these steps (refer this [image](https://www.manageengine.com/network-monitoring/help/images/agent-gpo-vbscript.jpg)): - Expand **Computer Configuration → Policies → Windows Settings → Scripts** - Right-click **Startup**, and click **Properties**. - Click **Show Files**. - Drag and drop the **[InstallOPMAgent.vbs](https://www.manageengine.com/network-monitoring/help/files/InstallOPMAgent.txt)** (download the .txt file and rename it as .vbs) and the extracted **OpManagerAgent.msi** and **OPMServerInfo.json** files to this location. Copy the path of this location **(\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup)** and close the window. - In the **Startup Properties** dialog box, click **Add**. - Browse and navigate to the location, and copy the browsed path (\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup). - Select **InstallOPMAgent.vbs** script. Then specify the path (copied location) and the script as mentioned below: ``` (\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup)\InstallOPMAgent.vbs ``` - Specify the script parameter as mentioned below: **OpManagerAgent.msi** 11. As an alternative to VBScript, you can also execute **PowerShell script** for agent installation using GPO. For executing PowerShell scripts, follow these steps and refer this [image](https://www.manageengine.com/network-monitoring/help/images/agent-gpo-powershell-script.jpg): - Ensure if PowerShell is enabled in all the client computers before execution of this script. - Expand **Computer Configuration → Policies → Windows Settings → PowerShell scripts**. - Right-click **Startup**, and click **Properties**. - Click **Show Files**. - Drag and drop the **[psinstallopmagent.ps1](https://www.manageengine.com/network-monitoring/help/files/psinstallopmagent.txt)** (download the .txt file and rename it as .ps1) and the extracted **OpManagerAgent.msi** and **OPMAgentServerInfo.json** files to this location. Copy the path of this location **(\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup)** and close the window. - In the **Startup Properties** dialog box, click **Add**. - Browse and navigate to the location, and copy the browsed path (\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup). - Select the **psinstallopmagent.ps1** script. Then specify the path (copied location) and the script as mentioned below: ``` (\\Domain name\SysVol\Domain name\Policies\{ID}\Machine\Scripts\Startup)\psinstallopmagent.ps1 ``` - Specify the script parameters as mentioned below: **OpManagerAgent.msi** 12. Click **"Okay"** to close the **Add a Script** dialog box and the Startup Properties dialog box, and close both the **Group Policy Object Editor** and the **Group Policy Management** dialog boxes too. **Note:** This script can be used to deploy the agent in all computers in the domain. Note that the target should not be a user group. This script will be executed on the next reboot of the client computers after the deployment. Once this script is executed successfully, the OpManager agent will be installed in all the client computers. You can check these newly added devices under the Inventory page in OpManager. **Note:** - The file association properties of .vbs files must be set to **'Microsoft Windows (r) based script host'** in all the client computers, to ensure the script gets executed properly. If the file association properties have been modified to open the script file with a text editor, execution will fail. - The OpManager GPO object can be left as such to install the agent in future client computers automatically. - You need not worry about the agent getting re-installed, as the script has been written in a way to prevent unnecessary re-installation of the agent. - You also need not worry about updating the agent periodically. Updates for the OpManager agent get released along with the OpManager installation files, and OpManager will automatically push the agent update to the client computers whenever it is available. Installing the OpManager agent on multiple devices using Windows GPO can be helpful, especially when other installation methods fail. Below are some common reasons for agent installation failures to help you identify and resolve the issue. - [Access denied](https://www.manageengine.com/network-monitoring/kb/agent-installation-errors.html#access_denied) - [Network path not found](https://www.manageengine.com/network-monitoring/kb/agent-installation-errors.html#network_path_not_found) - [Unknown username or password](https://www.manageengine.com/network-monitoring/kb/agent-installation-errors.html#login_failure) - [No network provider accepted the given network path](https://www.manageengine.com/network-monitoring/kb/agent-installation-errors.html#network_path_not_accepted) - [Not enough storage available to install agent](https://www.manageengine.com/network-monitoring/kb/agent-installation-errors.html#not_enough_server_storage) If you had any other issues with agent installation, please [contact our support team](mailto:opmanager-support@manageengine.com) to get it resolved.