I have a scenario where I need a non-domain joined Windows 10 to reboot after it gets joined to a domain and there's a logon of a domain user - any domain user, not a specific one. I'd also need this reboot to happen only once after the initial logon on that user.
I've tried to create a scheduled task that runs when any domain user logs in and reboots the device but I can't seem to find a way of setting this domain user part up without the device already being domain joined? Is this even possible?
I'd also like for this to only happen once, so after the reboot (triggered by the logon on a domain user), I don't want the machine to reboot every time someone logs in. To try cover this off, I looked at Task Scheduler's 'Delete Task After' option but that doesn't look like it'd work either since the task will always be scheduled to run (when any domain user logs in).
Does anyone have any experience taking care of something like this? At this point, I'm pretty sure I'm trying to force a square peg into a round hole using Task Scheduler and that using something like PowerShell might be the better option.
Any ideas how I'd go about this?
Thanks in advance
Does it have to be a scheduled task? Group Policy can be configured for one-and-done type changes, and joining to a domain means that Group Policy will apply.
Taking that a step further, Group Policy can create Scheduled Tasks, too.
Use a Group Policy with a logon script, and write the script so that it only runs once (f.e. by checking and then setting a Registry key, or a file).