Create ConfigMgr12 IP Subnet Boundaries with PowerShell

In one of my ConfigMgr12 projects in Middle East, I faced a minor problem regarding boundaries.

Actually customer has more than 100 remote locations and much more subnets. Therefore we needed to create required boundaries for each subnet. It would be helpful if I could use Active Directory Site subnets as these subnets are discovered and added automatically by Forest Discovery, but in our situation it was not passible as customer had only one single site Smile Don’t ask why..

So I just created a simple excel file that includes all subnets for a specific boundary:

image

And then execute following script on ConfigMgr12 Server:

$excel = Import-csv c:aa.csv
foreach($item in $excel)
{
$Arguments = @{DisplayName = $item.’SUBNET’; BoundaryType = 0; Value = $item.subnet}
Set-WmiInstance -Namespace “RootSMSSite_xxx” -Class SMS_Boundary -Arguments $Arguments
}

This script simply:

  • Imports above excel csv file
  • for each line (item variable) it creates arguments variable. Display Name is the boundary name, 0 is the type of boundary, value is the subnets that will be read from excel file.
  • connects ConfigMgr12 wmi instance using ROOTSMSSite_SiteCode
  • Uses arguments variable for arguments parameter

You can also add additional columns in excel file for the Display Name and boundary type.

And yes, you can manage ConfigMgr with PowerShell easily..

zp8497586rq