Trigger a scheduled task at logoff or shutdown

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
dfornet@eprod.com
Posts: 1
Last visit: Thu Aug 13, 2020 1:11 pm

Trigger a scheduled task at logoff or shutdown

Post by dfornet@eprod.com »

I am attempting to run a scheduled task when the user begins the logoff process so that a scheduled task is run while the users profile is still active. I cannot find any reference to a command that would perform this function. I found -atlogon but thats it.

Any help will be greatly appreciated!

jvierra
Posts: 14755
Last visit: Mon Apr 12, 2021 6:08 pm
Answers: 9
Has voted: 3 times
Been upvoted: 7 times

Re: Trigger a scheduled task at logoff or shutdown

Post by jvierra »

There is no command that can do this. You can only run scripts at logoff via Group Policy.

Locked