Run a Script at Shutdown (OnShutdown): Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) K (Admin verschob die Seite Run a Script before Shutdown (OnShutdown) nach Run a Script at Shutdown (OnShutdown), ohne dabei eine Weiterleitung anzulegen) |
Admin (Diskussion | Beiträge) |
||
Zeile 2: | Zeile 2: | ||
Unreliable methods of running script/command at shutdown: | Unreliable methods of running script/command at shutdown: | ||
+ | *'''Task Scheduler''' event trigger on event id 1074/6006/6008 (<Select Path="System">*[System[Provider[@Name='User32'] and EventID=1074]]</Select>) depends on EventLog and TaskScheduler and doesn't fire reliably (or at all on Server Core 1909) | ||
+ | *'''Group Policy Shutdown''' can be terminated early, doesn't fire when fastboot is enabled (default in Win10+) and isn't supported on Server Core 1909 | ||
+ | *'''Register-WmiEvent''' -Class Win32_ComputerShutdownEvent can be terminated early, doesn't fire when fastboot is enabled (default in Win10+) and fails on Server Core 1909 | ||
− | |||
− | |||
− | |||
Version vom 30. September 2021, 07:42 Uhr
Unfortunately Windows does not bring a simple option to run a script/command at shutdown. There are some ways to do this, but all of this ways are no reliable and does not always works if you use fastboot.
Unreliable methods of running script/command at shutdown:
- Task Scheduler event trigger on event id 1074/6006/6008 (<Select Path="System">*[System[Provider[@Name='User32'] and EventID=1074]]</Select>) depends on EventLog and TaskScheduler and doesn't fire reliably (or at all on Server Core 1909)
- Group Policy Shutdown can be terminated early, doesn't fire when fastboot is enabled (default in Win10+) and isn't supported on Server Core 1909
- Register-WmiEvent -Class Win32_ComputerShutdownEvent can be terminated early, doesn't fire when fastboot is enabled (default in Win10+) and fails on Server Core 1909