Create a Boundary Group in ConfigMgr 2012 R2 with PowerShell

This PowerShell code is written for Chapter 3 of “Learn ConfigMgr 2012 in a Month of Lunches“, where the already-created Active Directory site boundary is added to a new Boundary Group.

This code does not create the Boundary as this is done via the Active Directory Forest Discovery Method.  Rather, it creates the Boundary Group and then adds the Boundary to the Group.

Although the code is written specifically for the scenario in the book, you can easily modify any of the variables for use in your own environment.

# Define Configuration Manager variables
 
$CMSiteCode = 'P01'
$BoundaryName = 'mol.sccmlab.net/Lab'
$BoundaryGroupName = 'SCCM Lab Boundaries'
 
# 1.0 Get Existing Boundary
 
$Boundary = Get-CMBoundary -BoundaryName $BoundaryName
 
# 1.1 Create Boundary Group
 
New-CMBoundaryGroup -Name $BoundaryGroupName `
  -Description 'All Boundaries in the SCCM Lab environment' `
  -DefaultSiteCode $CMSiteCode `
 
# 1.2 Get Newly-created Boundary Group
 
$NewBoundaryGroup = Get-CMBoundaryGroup -Name $BoundaryGroupName
 
# 1.3 Add Boundary to Boundary Group
 
Add-CMBoundaryToGroup -BoundaryName $Boundary.DisplayName -BoundaryGroupName $NewBoundaryGroup.Name

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>