Running a powershell script at startup

Posted by RandellK02 on Super User See other posts from Super User or by RandellK02
Published on 2013-07-01T03:31:28Z Indexed on 2013/07/01 4:23 UTC
Read the original article Hit count: 580

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

© Super User or respective owner

Related posts about scheduled-tasks

Related posts about powershell-3.0