Installing OMS agent with PowerShell

Operations Management Suite (OMS) is a great thing and easy (and fast) to getting started with just installing an agent on a server. However, installing OMS agent would be nice to get automated and instead of doing it with the command line it could be done with PowerShell, compared to doing it manually which would take s significant amount of time. Keep reading to find out how to install OMS agent with PowerShell.

I have checked the command line installation option and that isn´t as good and fancy as doing it with PowerShell, hence this post. I have put together a PowerShell Script that will download the agent, install it and remove the installation files. All you need is the Workspace ID and Workspace Primary Key.

Running the script

You need to run the script as an administrator, and you will also need internet access from the server to download the files. However, if you don´t have internet access you could always download the agent somewhere else and copy it to the folder C:\Source and the agent would be installed by the script. Then you could still use the OMS gateway to communicate with OMS.

See below for what it looks like running the script;

Now when the installation is done, you can check out the properties of the agent in the Control Panel under “System and Security”. Hopefully you will see what I see below, and you will very soon see your server in the OMS workspace.

The script is seen below for you to just copy it, and I have also uploaded it to TechNet Gallery here.


I hope this will help you out in installing OMS agents in your environment. What´s good to know is that I have deactivated the section in the script that deletes the C:\Source folder when the installation is done. This is simply because you shouldn´t delete the folder if you have any other important files in there. Feel free to use the line if you want to, but you will need to activate yourself by editing the script and removing the lines 64 and 75.

If there are any questions, just leave a comment below and I´ll get back as soon as possible. Otherwise, have fun deploying OMS agents in your environment 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *