使用 PowerShell 在 SCCM 中配对 SCCM 边界和边界组

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

我正在尝试将我创建的一些边界与其各自的边界组配对。边界组描述确实包含边界组名称和一些添加的字符作为标识符 (coa)。

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

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

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

不太对。令人惊讶的是,Where-Object 没有 return 任何东西。

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

此代码从 CSV 文件创建边界,然后将它们添加到预先存在的同名边界组中。

我花了一些时间才搞定!!! :)