I have a script which, when ran manually, works just fine. When I configure it to run as a scheduled task though this portion of the script never completes even though task scheduler marks it as successful. I've commented out every other line of the script to isolate this part being the first failure.
The settings for the scheduled task are quite simple. Running the task as a service account which has log on as batch rights, run whether logged on or not and with highest privileges. Trigger is daily at 4am. Action is start a program (
.\script.ps1 as argument and starting in
Set-Service -Name *service* -StartupType Disabled