Running a powershell script at startup
- by RandellK02
I am writing a script to remove a computer from the domain, rename it, then add it back. It works fine when I set the trigger to AtLogOn but when I switch to AtStartUp I run into some issues.
I get this error when it restarts to run the first scheduled task:
0x8007051F: There are currently no logon servers available to service the logon request.
I suspect the script tries to run with no network connection set up so I tested using the RandomDelay parameter, and it worked like its suppose to.
I cant rely on a random delay so I am looking for an alternative. Is there a way to test the network status before the script begins or a way to delay the script a specific amount of time? I am using Register-ScheduledJob provided by Powershell 3.0
Thanks in advance