I'm trying to automate the process of configuring scheduled tasks so I can create the same task on dozens of computers. Right now, I have a very simple script that should add a job:
import-module PSScheduledJob
$trig=new-jobtrigger -Once -At ((get-date).addminutes(1))
Register-scheduledjob -FilePath <Test_File.ps1> -Name "Tester" -Trigger $trig
The test file works fine when run from the ISE, but does nothing after I wait for the scheduled task to work. Also, nothing appears in the Task Scheduler GUI, or when I use the get-job
cmdlet. Running get-scheduledjob
though, I do see the scheduledjob object just like it should be; seems like there's a disconnect somewhere.
Finally, I can't download any additional modules in my environment, otherwise I'd try other routes.
I am running this as an admin.
Update: I do now see the task in task scheduler GUI. However whenever it runs, it times out before doing anything. Still unsure why it's not able to call my script though.