Sample script at the end for this article.

I was recently at a customer that wanted to add new boundaries based on their DHCP-Scopes. This would be a very easy task if they only had a few, but they had well over a two-hundred scopes so I decided to create a PowerShell script to do the Job. One thing you need to bear in mind when doing this is that a DHCP-Scope can range from 10.10.10.1 – 10.10.10.254 which means when creating these boundaries that all client in this range are supported, no one is left out. However, a DHCP scope can also range from 10.10.10.100 – 200 which means that if a computer or server is not using DHCP but has been given an IP-address like 10.10.10.43 from an administrator which is outside the range and the computer or server has a ConfigMgr agent it would be left outside and would not be managed by ConfigMgr.

Well let’s go to the good stuff. First and foremost, we need to export the DHCP-Scopes to a comma separated CSV file. Run this command on your DHCP Server

If you open the csv file in Notepad it should look something like this

image

Next save the csv file on a drive on your ConfigMgr Primary server where you want to import the Boundaries. In my environement I have used D:\Scripts

Then open a eleaveted PowerShell prompt and run the script as follows

image

Then yous should be able to see all your newly created boundaries in your ConfigMgr Console!

image


The Script:

Do not forget to leave a comment if you have any questions – Have a great Easter! Smilefjes