How to connect Multiple VMs with OMS using a single PowerShell script.

%3CLINGO-SUB%20id%3D%22lingo-sub-199498%22%20slang%3D%22en-US%22%3EHow%20to%20connect%20Multiple%20VMs%20with%20OMS%20using%20a%20single%20PowerShell%20script.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199498%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20we%20can%20connect%20the%20multiple%20VMs%20with%20OMS%20Using%20the%20PowerShell%20script.%20and%20to%20remove%20them%20from%20OMS%20Environment%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-199498%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAutomation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAutomation%20and%20DSC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOMS%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVirtual%20Machine%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-199853%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20How%20to%20connect%20Multiple%20VMs%20with%20OMS%20using%20a%20single%20PowerShell%20script.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199853%22%20slang%3D%22en-US%22%3EYeah%2C%20thank%20you.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-199652%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20How%20to%20connect%20Multiple%20VMs%20with%20OMS%20using%20a%20single%20PowerShell%20script.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199652%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20already%20documented%20nicely%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flog-analytics%2Flog-analytics-agent-windows%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flog-analytics%2Flog-analytics-agent-windows%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20use%20the%20CMDLine%20commands%20in%20a%20Powershell%20script%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-199642%22%20slang%3D%22en-US%22%3ERE%3A%20How%20to%20connect%20Multiple%20VMs%20with%20OMS%20using%20a%20single%20PowerShell%20script.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199642%22%20slang%3D%22en-US%22%3EBut%20we%20don't%20have%20any%20PowerShell%20script%2C%20we%20want%20that%20script%2C%20please%20tell%20us%20where%20to%20get%20that%20script.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-199639%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20connect%20Multiple%20VMs%20with%20OMS%20using%20a%20single%20PowerShell%20script.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199639%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20could%20use%20Get-AzureRMVM%20%7C%26nbsp%3BSet-AzureRmVMCustomScriptExtension%20to%20deploy%20a%20Powershell%20script%20that%20links%20them%20to%20OMS.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

How we can connect the multiple VMs with OMS Using the PowerShell script. and to remove them from OMS Environment? 

4 Replies

You could use Get-AzureRMVM | Set-AzureRmVMCustomScriptExtension to deploy a Powershell script that links them to OMS.

But we don't have any PowerShell script, we want that script, please tell us where to get that script.

That's already documented nicely here: https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-agent-windows

You can use the CMDLine commands in a Powershell script