Create SCCM 2012 boundaries and boundary groups

Hi SysAdmins

If you are managing your enterprises’ servers and workstations with SCCM 2012 (as you should do) ,

you probably will need to build boundaries, boundary groups and add these boundaries to boundary groups.

This will make sure that the site server DP that you join with a specific boundary group will distribute content only to workstations in its associated boundaries.

This was known as protected boundary in SCCM 2007.

If you need to create SCCM 2012 boundaries and boundary groups automatically without repeating the process over and over,

The following Powershell script will receive a list of data from a .CSV file and create boundaries and boundary groups respectively.

Download the powershell script from HERE.

Download a template of the CSV file from HERE.

$BoundaryList = Import-Csv “D:\Scripts\BoundaryList.csv”

foreach ($_ in $BoundaryList)
{

$getbg = Get-CMBoundaryGroup -Name $($_.BGDisplayName)
if ($getbg -eq $null)
{
New-CMBoundaryGroup -Description $($_.BGDescription) -Name $($_.BGDisplayName)
}
$getbn = Get-CMBoundary -Name $($_.DisplayName)

if ($getbn -eq $null)
{
New-CMBoundary -DisplayName $($_.DisplayName) -BoundaryType IPSubnet -Value $($_.IPSubnet)
Add-CMBoundaryToGroup -BoundaryGroupName $($_.BGDisplayName) -BoundaryName $($_.DisplayName)
}}

Please let me know if you have any issue with this.

 

4 thoughts on “Create SCCM 2012 boundaries and boundary groups”

  1. Hello ,

    first of all thank you for you post.
    I followed the insctruction but it fails for me . saying that functions does not exist..

    here is the error retured
    PS C:\Temp\boundaryscript> .\BuildSCCMEnv.ps1
    Get-CMBoundaryGroup : The term ‘Get-CMBoundaryGroup’ is not recognized as the name of a cmdlet, function, script file,
    or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
    try again.
    At C:\Temp\boundaryscript\BuildSCCMEnv.ps1:25 char:10
    + $getbg = Get-CMBoundaryGroup -Name $($_.BGDisplayName)
    + ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-CMBoundaryGroup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    New-CMBoundaryGroup : The term ‘New-CMBoundaryGroup’ is not recognized as the name of a cmdlet, function, script file,
    or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
    try again.
    At C:\Temp\boundaryscript\BuildSCCMEnv.ps1:28 char:2
    + New-CMBoundaryGroup -Description $($_.BGDescription) -Name $($_.BGDisplayName)
    + ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (New-CMBoundaryGroup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Get-CMBoundary : The term ‘Get-CMBoundary’ is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At C:\Temp\boundaryscript\BuildSCCMEnv.ps1:30 char:11
    + $getbn = Get-CMBoundary -Name $($_.DisplayName)
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-CMBoundary:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    New-CMBoundary : The term ‘New-CMBoundary’ is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At C:\Temp\boundaryscript\BuildSCCMEnv.ps1:34 char:2
    + New-CMBoundary -DisplayName $($_.DisplayName) -BoundaryType IPSubnet -Value $($ …
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (New-CMBoundary:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Add-CMBoundaryToGroup : The term ‘Add-CMBoundaryToGroup’ is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At C:\Temp\boundaryscript\BuildSCCMEnv.ps1:35 char:2
    + Add-CMBoundaryToGroup -BoundaryGroupName $($_.BGDisplayName) -BoundaryName $($_ …
    + ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Add-CMBoundaryToGroup:String) [], CommandNotFoundException

    1. Hello
      You need to run this in PowerShell from the Configuration Manager Console:
      https://blogs.technet.microsoft.com/configmgrteam/2013/03/27/powershell-connecting-to-configuration-manager/
      or use import-module:
      C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin> import-module .\ConfigurationManager.psd1

  2. Hi Could you please mail me the scripts for the “Create SCCM 2012 boundaries and boundary groups” the links on this page do not work.

    1. Hi Paul
      Very sorry for the broken link. It is correct now.
      I will send it to you via Email as well.

Leave a Reply