I have a CSV which i have processed subnet information in using CONCAT and some other functions. I have address range boundaries and Sites and want to automate the creation of SCCM IP Address Range boundaries using PowerShell and the CSV file and New-CMBoundary cmdlet. Please See below:
- Column B is the Site Code
- Column F Contains the Range e.g. 192.168.1.0-192.168.1.254
Code so far:
'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin'
Import-Module .\ConfigurationManager.psd1
cd SCC:
Get-CMSite
$subnetranges = import-csv C:\subnets.csv
$Site = $subnetranges | select -ExpandProperty "Site Code"
$Range = $subnetranges | select -ExpandProperty "VLAN5 Range"
ForEach ($subnet in $subnetranges) {
New-CMBoundary -DisplayName $Site -BoundaryType IPRange -Value $Range
}
This obviously isn't quite right, Can you see what I'm trying to do? how do i get each row from the CSV into the respective variable but then enumerate through using the ForEach loop? If that is even the best method.
Thanks in Advance