Import DHCP Scopes as SCCM Boundaries

A little tip that might save you some time.

If you are installing a SCCM 2012 environment at a customer, you will probably need to create Boundaries. It’s common to miss some IP subnets or misspell something 

These simple Powershell lines will export all Scopes from an DHCP server and import them as Boundaries

Step 1:

Install DHCP Server tools in Server manager

Step 2:

Export Scopes from DHCP server

Import-Module DhcpServer

Get-DhcpServerInDC

Get-DhcpServerv4Scope –ComputerName dhcpserver.fullfqdn.com | select ScopeID,Name | Export-csv C:\dhcpscopes.csv -encoding “unicode”

Step 3:

Remove the beginning lines in your CSV file

Step 4:

Create Boundaries. This will name Boundaries like this: “192.168.0.0 – Client PXE Network”

import module ‘D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1′

$smsproviderloc = “select * from sms_providerlocation”

$sc = Get-WmiObject -Query $smsproviderloc -Namespace “root\sms” -ComputerName localhost

$sc = $sc.sitecode

cd $sc':’

$CSVFile = “C:\dhcpscopes.csv”

Import-CSV $CSVFile -Header Name,Value | Foreach-Object {

$BoundaryName = $_.Value + ‘ – ‘ + $_.Name

New-CMBoundary -Name $BoundaryName -Type ‘IPSubnet’ -Value $_.Value

}

 

This entry was posted in Powershell, SCCM, Scripting, System Center. Bookmark the permalink.
Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

*


+ four = 5

* Copy This Password *

* Type Or Paste Password Here *

8,622 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>