Recently, I had to enable ACS Forwarding on a percentage of the systems reporting to my SCOM Management Group. All of the examples that I found on the Internet were for enabling ALL of the systems in a management group. For me, that was about 5,500 systems too many. So, I made a quick PowerShell script that did the job for me. There are 2 parts to this script. 1.) Input File - This file containts the list of hostnames that you wish to enable ACS Forwarding on. 2.) PowerShell Script. Here is an example of the script:
ACS_Enable.ps1
#### FUNCTION DECLARATION BEGIN
Function enableACSForwarder
{
param ($targetHostname)
Write-Host “Enabling Audit Collection for:” $targetHostname
cd <mgmtserver>\Microsoft.SystemCenter.AllComputersGroup\$targetHostname\Microsoft.SystemCenter.HealthService
Start-Task -task:$enableAcsTask -overrides:$overrides -credential:$credentials
}
#### FUNCTION DECLARATION END
$collectorServerName = “<your collector server name here>”
$enableAcsTask = get-task -path \ | where {$_.Name -eq ‘Microsoft.SystemCenter.EnableAuditCollectionService’}
$overrides = new-object Hashtable
$overrides.Add(“CollectorServer”,$collectorServerName)
$credentials = Get-Credential
get-content C:\acs_enable_input.txt | ForEach-Object { enableACSForwarder $_ }