PowerShell User settings

We are attempting to run a powershell script if a user in a specific AD group logs into a machine. The script will grab the current user ID and SID and adjust some registry settings for a migration. We can run the script if the user is already logged in but not if a user logs in after the task assignment. I added a Start-Sleep -Seconds 120 in the script thinking that it would help but it still will not grab the SAMAccountName .

Thx

Are you using “Dynamically Target by Property” when you send the action, or just selecting computers that match the group property at the time you send the action?

Jason, I am using a few test PCs and they are all waiting until the user logs in. The script starts and is running but never finishes. If the user is already logged in it works just fine.

I got it! I decided to use action script, move the script to a directory that everyone has write to and run the script as current user.