none
PowerShell script to create new boundary / boundary group

    Question

  • Hi Everyone,

    I used the below script to create boundary/boundary group and added the existing site server to boundary group,

    -------------------------------------

    $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)
    Set-CMDistributionPoint -sitecode SUZ -SiteSystemServerName $($_.Server) -AddBoundaryGroupName $($_.BGDisplayName)
    }}

    ----------------------------------

    Boundary and Boundary group created without any issue but DP doesn't added to the newly created boundary and getting the below error, can anyone help me to fix this error?

    

    Thursday, March 29, 2018 12:07 PM

Answers

  • Thanks for your update Matthew,

    My script worked when i try to do it from CAS server. Thanks for your support


    • Edited by Kalyan Sundar Thursday, March 29, 2018 3:08 PM spelling mistake
    • Marked as answer by Kalyan Sundar Thursday, March 29, 2018 3:08 PM
    Thursday, March 29, 2018 3:04 PM

All replies

  • This is how I do it:  add the site server (DP /secondary) to the boundary group.

    Set-CMBoundaryGroup–AddSiteSystemServer

    --boundary group

    New-CMBoundaryGroup-Name $BoundaryGroup-DefaultSiteCode $PrimaryServer

    $BoundaryGroupObject=Get-CMBoundaryGroup -name $BoundaryGroup

    $boundaryGroupobject|Set-CMBoundaryGroup –AddSiteSystemServer $siteServer

    -- boundary

    $NewBoundary=New-CMBoundary -Name $BoundaryName -BoundaryType IPSubnet -Value$IP

    Add-CMBoundaryToGroup -BoundaryGroup $BoundaryGroup -Boundary $NewBoundary 


    http://www.sccm-tools.com http://sms-hints-tricks.blogspot.com



    Thursday, March 29, 2018 2:51 PM
  • Thanks for your update Matthew,

    My script worked when i try to do it from CAS server. Thanks for your support


    • Edited by Kalyan Sundar Thursday, March 29, 2018 3:08 PM spelling mistake
    • Marked as answer by Kalyan Sundar Thursday, March 29, 2018 3:08 PM
    Thursday, March 29, 2018 3:04 PM