Share via


Enabling ACS Forwarder by filter

On Large environments it's very common use Audit Collection Service. With the powershell script below, it's possible enable ACS Forwarder automatically.
This is the "Monitoring" workspace on SCOM Console showing ACS Views:

The Collector Server in my lab:
ACS Filter 02

My Forwarders. I don't have any at the moment:
ACS Filter 03

The script below has two parameters for change: "$collectorName = 'Name of your Collect Server' " and "($Object -like '*String for filter the servers*')"
ACS Filter 04

Below you can see the script code. It's a very simple script:

$collectorName = 'LAB-SCOM02.mgs.lab' $override = new-object Hashtable $override.Add('CollectorServer',$collectorName) $healthServices = Get-SCOMClass -Name 'Microsoft.SystemCenter.HealthService'| Get-SCOMMonitoringObject $EnableAcsTask = Get-SCOMTask | Where {$_.Name -eq 'Microsoft.SystemCenter.EnableAuditCollectionService'} write-host $EnableAcsTask foreach($Object in $healthServices){ if ($Object -like '*SQL*'){ write-host $Object Start-SCOMTask -Task $EnableAcsTask -Instance $Object -Override $override } }

I execute using the filter "SQL" for enable ACS Forwarder at any server with the string "SQL" at the name:
ACS Filter 05

Now I can see at the "Forwarder State View" the server LAB-SQL01:
ACS Filter 06

I create this script for using like an example when you have a lot of servers for enable ACS Forwarder. It's possible increase the script for enable automatically using many strings for filter and running with a Schedule Task.