Very often in an on-premise or hybrid Skype for Business Server setup, there is a need to get a current list of a particular server role. Rather than hard-coding this information, consider the following approaches:
$site = ‘HK’
$role = ‘*Registrar*’
#OPTION A
$site1 = Get-CsPool -site $site
$reg = $site1 | ? Services -like $role
$reg.Identity #pool FQDN
$reg.Computers #machines in each pool
#OPTION B
$role = Get-CsService -Registrar | ? PoolFqdn -like “*$site*”
$c = @()
foreach ($spool in $role.PoolFqdn)
{
$c += Get-CsComputer -Pool $spool
}
$role.PoolFqdn #pool FQDN
$c.Identity #pool machines