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.

Summary

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 🙂

5 thoughts on “Installing OMS agent with PowerShell Add Yours?

  • Hi Dan,
    In our environment, we already have SCOM2012R2 and used your script to upgrade/configure OMS workspace(on few test servers), but after running the script I have noticed that workspace details were not added, I have tried giving parameter differently but did not work either, is this a known thing or specific to the environment?
    Note: I am able to add the workspace details manually after Script finished upgrading the agent.

    • This script is not meant to be used for upgrading an agent. If you’re running SCOM you should connect your Management Group to OMS instead of separate registration of agents.

      • Because of some reasons we are not connecting the management group, is there any way to configure workgroup settings through scripting while upgrading agents?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: