I have a Powershell script that runs a process undefinitely.
I want it to perform a few commands before the PC's shutdown.
Here is the process I would like :
- User clicks shutdown button
- Windows shows the black screen
- Windows displays my script as 'preventing shutdown'
- The script receives a signal saying the system has to shut down
- The script runs a few commands and then exits
- Windows detects nothing is preventing shutdown ans shuts down
Would that be possible ? Thanks in advance !