PowerShell script to assist with ISC DHCP to DNSMasq DHCP migration

Started by badbroccoli, May 25, 2025, 06:25:45 PM

Previous topic - Next topic


Greetings all,

I recently wrote a PowerShell script to assist with migrating my OPNSense implementation from ISC DHCP to DNSMasq DHCP and wanted to share it here in case it can help anyone else.

The script ingests an OPNSense backup XML and converts the enabled ISC DHCP and DHCPv6 scopes into DNSMasq ranges and creates DNSMasq host entries for each ISC static mapping found in the enabled scopes. Currently it also adds NTP Server and Domain options for the ranges if they are configured in the ISC scopes.

Happy to review pull requests / issues if there are any improvements that can be made to make this more widely beneficial.

Cheers!

https://github.com/dreary-ennui/Convert-OPNSenseISCDHCPtoDNSMasqDHCP

Now can you ELI5 how to get around the error?
Convert-OPNSenseISCDHCPtoDNSMasqDHCP.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.

Networking and Windows in general, I'm pretty good at. Powershell is a whole new realm to me :-D

Get-ExecutionPolicy shows "Restricted"

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
https://answers.microsoft.com/en-us/windows/forum/all/cannot-get-powershell-script-to-run/900edc39-35e8-4896-92d0-05aad75eac87

powershell by default has a policy to deny the running (Execution) of scripts. The command above removes it.
Your search string is "ps1 cannot be loaded because running scripts is
disabled on this system". Of course ps1 can be any script i.e ps1, ps2 .etc.