Install the OMS agent using GPO automation with Powershell OMS WorkSpace lookup #MSOMS #Azure

Suppose you want to deploy the OMS ( Microsoft Operations Management Suite ) Agent but you don’t want to do this by hand. Well Supposed you could run a Powershell script that installs the Agent. But in this case it is about deployments and a lot of VM’s are getting deployed and removed and you don’t want to put the Agent in the Template VM. I recently had to build a poor man’s lightweight deployment solution. As there is noting yet in the Cloud I used the good Old Active Directory.

https://www.microsoft.com/en-us/cloud-platform/operations-management-suite

Microsoft Operations Management Suite

So Old Skool deployment by GPO as you could use this for any file or solution. and yes Powershell could also be handy but in this case the VM’s can be remote controlled as the remote Port is firewalled.

https://robertsmit.wordpress.com/

Create a GPO in my case “ Deploy-OMS”

Edit the GPO

image

and Go to the Computer Settings right Click on the folder choose New and folder 

image I use Update the folder Pick a name

Now the GPO Creates a folder on all targeted Machines I did place this GPO on top be carful with that!

 

image

Next same as on the Folder new file

image

In this new file I’ll use the Source and destination keep in mind the destination is on the machine where the agent needs to be.

imageimage

Do this for both files or if you have more then do this per file and If you want to limited this a bit there a a few options to do that.

the Apply once option and the Item-Level targeting based on your Query the GPO will Execute or Not. (this is not needed but it is optional )

image

As I used a CMD batch file you need to create one with your task

I used this one liner to install the OMS Agent use your own key and save this file as a CMD file

"c:\Package-deploy\MMASetup-AMD64.exe" /C:"setup.exe /qn ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_ID=d69d8969-1111-4586-80f0-4a11bc111199c OPINSIGHTS_WORKSPACE_KEY=3zNTcggsfsfsdgjhkldsaOyQ0/dgMwsbdtrgQVPXqu== AcceptEndUserLicenseAgreement=1"

 

image image

In case you can’t find the Workspace ID check your portal and go to the settings Dashboard. and get your info.

image

But In case you want to do a little bit of Powershell.  OMS Powershell

First let me check if the Modules are installed if not Install the modules.

 

Find-Module AzureRM.OperationalInsights | Install-Module
Install-Module AzureRM.OperationalInsights -Scope CurrentUser
Get-Module AzureRm.OperationalInsights

https://robertsmit.wordpress.com/

Next we need to login to your Subscription

Login-AzureRmAccount
Get-AzureRmSubscription

If you have Multiple subscriptions pick the right one

Select-AzureRmSubscription –SubscriptionId

#Get your WorkSpace ID
Get-AzureRmOperationalInsightsWorkspace |select Name,ResourceGroupName,CustomerId

image

I use these two as variable

$ResourceGroupName = "OI-Default-East-US"
$WorkSpaceName = "clustermvp"

Now we get the key that we needed.

Get-AzureRmOperationalInsightsWorkspaceSharedKeys -ResourceGroupName $ResourceGroupName -Name $WorkSpaceName

image

See how easy Powershell is just take baby steps find the info and you will learn every day step by step.

 

Follow Me on Twitter @ClusterMVP

Follow My blog https://robertsmit.wordpress.com

Linkedin Profile Http://nl.linkedin.com/in/robertsmit

Google Me : https://www.google.nl

Bing Me : http://tinyurl.com/j6ny39w

Author: Robert Smit [MVP]

Robert Smit is Senior Technical Evangelist and is a current Microsoft MVP in Clustering as of 2009. Robert has over 20 years experience in IT with experience in the educational, health-care and finance industries. Robert’s past IT experience in the trenches of IT gives him the knowledge and insight that allows him to communicate effectively with IT professionals who are trying to address real concerns around business continuity, disaster recovery and regulatory compliance issues. Robert holds the following certifications: MCT - Microsoft Certified Trainer, MCTS - Windows Server Virtualization, MCSE, MCSA and MCPS. He is an active participant in the Microsoft newsgroup community and is currently focused on Hyper-V, Failover Clustering, SQL Server, Azure and all things related to Cloud Computing and Infrastructure Optimalization. Follow Robert on Twitter @ClusterMVP Or follow his blog https://robertsmit.wordpress.com Linkedin Profile Http://nl.linkedin.com/in/robertsmit Robert is also capable of transferring his knowledge to others which is a rare feature in the field of IT. He makes a point of not only solving issues but also of giving on the job training of his colleagues. A customer says " Robert has been a big influence on our technical staff and I have to come to know him as a brilliant specialist concerning Microsoft Products. He was Capable with his in-depth knowledge of Microsoft products to troubleshoot problems and develop our infrastructure to a higher level. I would certainly hire him again in the future. " Details of the Recommendation: "I have been coordinating with Robert implementing a very complex system. Although he was primarily a Microsoft infrastructure specialist; he was able to understand and debug .Net based complext Windows applications and websites. His input to improve performance of applications proved very helpful for the success of our project

One thought on “Install the OMS agent using GPO automation with Powershell OMS WorkSpace lookup #MSOMS #Azure”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: