none
Creating DHCP multiple DHCP scopes RRS feed

  • General discussion

  • Greetings! I think I'm close but need a little extra push to get this right.

    Throughout this year I will need to create 16-20 DHCP scopes at a time every 4 months or so. I'll be opening 4-5 sites with 4 scopes per site. I've built an Excel workbook with necessary information but I think this can be done slightly easier with calling a file and getting data from the file but I don't really understand how to do that.

    Here is the final cell formula I built out and I'd just need to change the referenced cells so I hit all the scopes.

    =CONCAT("Add-DhcpServerv4Scope -ComputerName usdhcp110.leinternal.com -Name ",Sheet1!B2," -ScopeId ",Sheet2!E2," -StartRange ",Sheet2!B2," -EndRange ",Sheet2!C2," -SubnetMask ",Sheet2!D2," -LeaseDuration 2.00:00:00 -type Dhcp -State Active")

    After this, I'll need to set scope options for gateway, domain, dns where I plan on basically doing the same thing

    Set-DhcpServerv4OptionsValue -ComputerName usdhcp110.domain.com -Router <$GatewayIP> -DnsDomain "domain.com" -DnsServer ("10.175.254.10","10.175.254.11")

    Like I said, I don't think this is as efficient as I've seen some scripts where you can call a CSV file and pull data from it but I'm not sure how that works. Are there any resources you can point me to directly to try to comprehend how that works or nudge me in the right direction if I'm already pretty close? My end goal is to run a script or batch file that brings up a prompt asking for "Name, Octet" and then it builds everything out for me. I don't understand how to get there though. If you're able to assist, I'll return the favor with BGP, OSPF, EIGRP knowledge... :D

    Thanks

    mike

    • Changed type Bill_Stewart Friday, March 15, 2019 7:06 PM
    • Moved by Bill_Stewart Friday, March 15, 2019 7:06 PM Unanswerable drive-by question
    Tuesday, February 5, 2019 4:18 PM

All replies

  • Are there any resources you can point me to directly to try to comprehend how that works or nudge me in the right direction if I'm already pretty close?

    I would recommend starting with the Learn link at the top of this forum.

    My end goal is to run a script or batch file that brings up a prompt asking for "Name, Octet" and then it builds everything out for me.

    If you end up writing a script that might be useful for others, you can add it to the Repository. You can also search there for examples that might be related to whatever it is you're trying to do.

    Of necessity, this forum is really designed for specific scripting questions. Your question is very vague and broad and doesn't really fit into that scope.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, February 5, 2019 4:40 PM