Author Posts

April 19, 2018 at 3:12 pm

Hello there everyone,
I tried running the following script as a scheduled job, but for some reason it does not run as a scheduled job. The script works, but I believe that I may be doing something incorrectly with the register-schedulejob comdlet. Anyone might providing input? Thank you very much. this has been a hit or miss for me and I am near certain that I am doing something incorrectly. Thank you again for taking your time to help!

receive-job * -keep returns nothing.


Import-Module activedirectory
$Trigger = @()
$Trigger += New-JobTrigger -Daily -at "1:00 PM"
$Trigger += New-JobTrigger -Daily -at "5:00 PM"
$Option = New-ScheduledJobOption -RequireNetwork -WakeToRun
$Credentials = Get-Credential
 Register-ScheduledJob -Name "Provision-Computers" -ScriptBlock { 

} -Trigger $Trigger -ScheduledJobOption $Option -MaxResultCount '2' -Credential $Credentials -RunNow

April 24, 2018 at 5:54 pm

Do you see the job if you run Get-ScheduledJob?

I haven't worked with Scheduled Jobs much, but Scripting Guy wrote an introduction to Scheduled Jobs that might be helpful: