Install/OnPrem/XP/Scaled/ContentManagement/Configure-AppPoolAccessToPerformanceMonitoring.ps1

Import-Module "$PSScriptRoot\..\..\..\..\..\Common\WebAdministration-Module.psm1" -Force
$ErrorActionPreference = "Stop"

Write-Output "Configure AppPool access to performance monitoring started..."

$groups = @("Performance Log Users", "Performance Monitor Users")

$pools = @()
foreach ($server in $global:Configuration.sitecore) {
    $pools += $server.hostNames[0]
}

AddAppPoolUserToGroups -AppPools $pools -Groups $groups

Write-Output "Configure AppPool access to performance monitoring done."