r/PowerShell • u/QuickBooker30932 • Nov 23 '25
Run script when PC unlocked
I have a script that already runs properly when a user logs in, but I'd like it to run when when the user unlocks the PC too. I tried creating a task in Task Scheduler, and I can see PowerShell running, but the script doesn't run. What am I doing wrong?
6
Upvotes
View all comments
Show parent comment
2
u/lan-shark Nov 23 '25 edited Nov 23 '25
Does the script work when you run it manually? Does the job work if you trigger it manually? Also, does the script need any local assets? If so you may need to add something to the "start in" field.
For arguments, try with
-File:EDIT: If, for some reason, you don't want to use
-FileI think you can put the whole as the action target:This may not work, I'm on my phone so I can't double check