user3864861
user3864861

Reputation: 1

how to execute powershell script when user logout

I am trying to run a powershell script to upgrade enterprise software. However since if someone singed-in to the computer it is hard to find time to run this script. Therefore, I have make the script to wait until user logged-out.

I know how to find out if someone is logged into the pc. I need to know how to make powershell script wait until the user logged out.

Upvotes: 0

Views: 2904

Answers (1)

ferosi44
ferosi44

Reputation: 25

You can (and should) do this using Scheduled Tasks, the event ID for logout should be 4647. Tie your script to this event and it will run when the user logs out.

https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4647

Upvotes: 2

Related Questions