You can create a local computer policy on Windows. See the TechNet at https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/dn789197(v=ws.11)
- Run
gpedit.msc
to open the Group Policy Editor, - Navigate to Computer Configuration | Windows Settings | Scripts (Startup/Shutdown).