Adding direct agent OMS Workspace and Proxy via PowerShell


 

image

We have some REALLY good documentation on this here:  https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-windows-agents

 

PowerShell and the Agent Scripting Objects make it really easy to control the OMS direct agent configuration on thousands of agents, using SCOM.

 

Here are some PowerShell examples:

# Load agent scripting object
  $AgentCfg = New-Object -ComObject AgentConfigManager.MgmtSvcCfg

# Get all AgentCfg methods and properties
$AgentCfg | Get-Member

# Check to see if this agent supports OMS
  $AgentSupportsOMS = $AgentCfg | Get-Member -Name 'GetCloudWorkspaces'

# Get all configured OMS Workspaces
  $AgentCfg.GetCloudWorkspaces()

# Add OMS Workspace
  $AgentCfg.AddCloudWorkspace($WorkspaceID,$WorkspaceKey)

# Remove OMS Workspace
  $AgentCfg.RemoveCloudWorkspace($WorkspaceID)

# Get the OMS proxy if configured
  $AgentCfg.proxyUrl

# Set a proxy for the OMS Agent
  $AgentCfg.SetProxyUrl($ProxyURL)


I added these tasks to ADD and REMOVE OMS workspaces from the MMA, in the latest version of the SCOM Management helper pack:

https://blogs.technet.microsoft.com/kevinholman/2017/05/09/agent-management-pack-making-a-scom-admins-life-a-little-easier/

image


Comments (0)

Skip to main content