Search code examples
powershellsccm

Pairing SCCM Boundary's and Boundary Groups in SCCM Using PowerShell


I'm attempting to get some boundary's I've created paired to their respective boundary groups. The boundary group description does contain the boundary group name and some added characters as an identifier (coa).

Get-CMBoundary -BoundaryName *coa* | Where-Object {$_.DisplayName -cotains *coa* -and $_.Value -match $Site.Name}

Or

$boundarys = Import-Csv C:\M\boundarydata.csv
ForEach ($line in $boundarys) { 

$boundary = Get-CMBoundary -BoundaryName $line.SiteName
Add-CMBoundaryToGroup $boundary
}

Not quite right. Where-Object doesn't return anything, surprisingly.


Solution

  •     ForEach ($pos in $posrem) {
        New-CMBoundary -Name ($pos.StoreName + ' COA') `
        -Type IPRange -Value ($pos.COA + '-' + `
        $pos.COA2) | Add-CMBoundaryToGroup `
        -BoundaryGroupName ($pos.StoreName) 
    }
    

    This code creates boundarys from a CSV file, then add's them to pre existing boundary groups of the same name.

    Took me a while to get that!!! :)