like system startup it is not possible to execute a script at system shutdown with the task scheduler. It must be configured with a group policy. You can choose the GUI way are set it by script:
Let us assume the Script is C:\scripts\shutdownEv.cmd.
Windows by default releases the DHCP lease on shutdown. This is not useful if you often have to boot Windows and you want (if possible) the same IP Address Windows has before booting.
By default Windows interprets DHCP Option 2 submitted by the DHCP Server and if this is not set it release the lease.