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
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.
Create a GPO in my case “ Deploy-OMS”
Edit the GPO
and Go to the Computer Settings right Click on the folder choose New and folder
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!
Next same as on the Folder new file
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.
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 )
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"
In case you can’t find the Workspace ID check your portal and go to the settings Dashboard. and get your info.
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
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
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
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
One thought on “Install the OMS agent using GPO automation with Powershell OMS WorkSpace lookup #MSOMS #Azure”