I haven't tried it, but it works by accident, because
there is a big error in the script:
/ip dhcp-server network get number=[find where mac-address=$leaseActMAC] domain
The DHCP Networks do not have "mac-address"
In fact valerio's script correctly searches the name among the networks, using the IP...
:global GetDomain do={
:global DefaultDomain
:local ipaddr [:toip $1]
/ip dhcp-server network
:foreach network in [find] do={
:local netblock [get value-name=address $network]
:if ($ipaddr in $netblock) do={
:return [get value-name=domain $network]
}
}
:return $DefaultDomain
}
Also is useless search and read the hostname with
:local HostName [/ip dhcp-server lease get number=[find where mac-address=$leaseActMAC] host-name]
When already exist on purpose the variable
lease-hostname (but probably you are unable to use it for next point)
Just use $"lease-hostname"
And also the "debug" part is wrong, because both lease-hostname and lease-options must be surrounded by quotes or do not work correctly and broken the script
:log info message=("lease-hostname = " . $lease-hostname)
:log info message=("lease-options = " . $lease-options)
correct are $"lease-hostname" and $"lease-options"
Instead, regarding the fact that it is more logical to be done by the DHCP script, instead of the scheduler, it is more logical and correct.