Need help creating scheduled task with Powershell.

I’m trying to create scheduled tasks from within a Powershell script. The triggers for the first are lock or log off the triggers for the other would be sign in or log in. Both triggers would be for current user and not all users. I tried using the new-scheduled task and register scheduled tasks but was unable to figure out how to make those triggers. I then tried manually creating and exporting the scheduled task. I could successfully import the scheduled task as myself on my machine but had domain trust issues on other machines. I knew it wasn’t a trust issue but rejoined the pc to the domain anyway. I was able to create the tasks but it was for my user not current logged in user. I am fine with either method or a completely different method. Thank you.

submitted by /u/dsinton
[link] [comments]

Leave a Reply