#skype4b #powershell Get Registrar Pool Names from Cluster Id (msRTCSIP-PrimaryHomeServer)

Instead of legible plain text is a long string describing the distinguished name of the Skype for Business Front-End Server pool in the msRTCSIP-PrimaryHomeServer Active Directory user attribute. This can become difficult to identify and manage if several registrar pools exist in your environment whether they are located in the same or different sites.

To decipher the DN (pool cluster Id) into the fully qualified distinguished name of the corresponding #skype4b pools, … consider the code fragments as follows:

#require -version 3.0
#requirements: PowerShell for Active Directory and Skype for Business Server modules

$aduall = Get-AdUser -Properties ‘msRTCSIP-PrimaryHomeServer’ -Filter { samaccountname -like “*”}
$sfbPools = $aduall | group ‘msRTCSIP-PrimaryHomeServer’
$ht = @{}
$topo = Get-CsTopology
$topo.machines | % {
$o = @()
$_.Cluster | % {
$cluFqdn = $_.fqdn
$o = $_.machines
}
$ht[$cluFqdn] = $o
}

$pools = @()
$ht.keys | % {
$o = New-Object PsObject
$o | Add-Member -MemberType NoteProperty -Name PoolClusterId -Value $ht.$_.Cluster[0]
$o | Add-Member -MemberType NoteProperty -Name PoolFqdn -Value $_
$o | Add-Member -MemberType NoteProperty -Name PoolNodes -Value $ht.$_.fqdn
$pools += $o
}
#$pools | sort PoolFqdn | ft -auto

$objs =@()
$sfbPools | % {
$o = New-Object PsObject
$o | Add-Member -MemberType NoteProperty -Name PoolClusterId -Value “”
$o | Add-Member -MemberType NoteProperty -Name PoolFqdn -Value “”
$o | Add-Member -MemberType NoteProperty -Name PoolNodes -Value $_.Group

if ($_.Name -match ([regex]”CN=(\d{1,}):(\d{1,})”)) #!
{
$cluId = $matches[1]
$poolFqdn = ($pools.PoolClusterId | ? ClusterId -eq $cluId).Fqdn

$o.PoolClusterId = $matches[1]
$o.PoolFqdn = $poolFqdn
$o.PoolNodes = $_.Group
}
$objs += $o
} #$sfbPools

#$objs | sort PoolFqdn | ft -auto

Bookmark the permalink.

Leave a Reply