Creating S4B Network configuration from AD

This little powershell script will create the network configuration in Skype For Business, starting from the AD Site and Subnets definitions.

It is usefull if you don’t have CAC implemented, or if the implementation of CAC is the one suggested for a MPLS connection (=with a single region).


$region = "CompanyHub"
$subnets = Get-ADReplicationSubnet -Filter *

$subnets | % {
if (-not (Get-CsNetworkSite -Identity $_.site.split(",")[0].substring(3) -ErrorAction SilentlyContinue)){New-CsNetworkSite -NetworkSiteID $_.site.split(",")[0].substring(3) -NetworkRegionID $region}
New-CsNetworkSubnet -SubnetID $_.name.split("/")[0] -MaskBits $_.name.split("/")[1] -NetworkSiteID $_.site.split(",")[0].substring(3) -ErrorAction SilentlyContinue
}

What the script does is just reading all sites from Active Directory, then for each of them, if it is not already created, it creates the equivalent CSNetworkSite in the single region defined at the beginning.

For each AD site, then, it just adds all the subnets defined in that AD site.

Configuring Network site and subnet in Skype For Business is mandatory in case of CAC implementation, but it also improves the readability of QoE Reports.

There is only one gotcha to bear in mind: if a subnet is not defined in S4B, then that subnet will “disappear” from the reports since the reports will present the network site and not the subnets anymore (at the very first level).

My suggestion is to run this script once a month or at least each time a new subnet is defined in Active Directory.

I’ll keep you posted.

Corrado

Leave a Reply