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.
Continue reading Windows: Execute a Script at shutdown