The Chairman has returned with a new challenge that will test not only your PowerShell skills but your networking knowledge as well. The challenge has been graded for Intermediate and Advanced levels, but don’t let that stop you.
Depending on how you approach the challenge, you may find it easier to break it down into discrete parts.
Using PowerShell, write a function, or set of functions, that will test if an IPv4 address like 172.16.2.33/16 belongs to the 172.16.0.0 network. You should test your code with addresses that go beyond the /16 or /24 network boundaries. Or you might come at this from another angle. What is the subnet mask for an address like 172.16.10.20/17? And what network does that represent?
You will have to decide how to accept parameter values for the IP Address, subnet and/or subnet mask. Advanced users should include Verbose output showing the process. Advanced users should also provide 2 parameter sets. One to display a boolean value if the address belongs to the subnet and another to provide detailed information.
The Chairman looks forward to reading your comments with links to your solutions.