In this recipe, we're going to see the steps to remove the entries from the CronTab file.
Removing scheduled jobs in PowerShell
How to do it...
Now that we have created entries into the cron configuration file, let's attempt to remove those entries:
- List the jobs using the Get-CronJob cmdlet. This will get you the list of jobs that are created by reading the CronTab file:
PS> Get-CronJob | Format-Table -AutoSize
- Apply a conditional logic to segregate the required job entries using the Where-Object clause. You will read more about this in Chapter 4, Passing Data Through Pipelines:
PS > Get-CronJob | Where-Object {$_.Month -match 'Jan'} | Format-Table -AutoSize
Minute Hour DayOfMonth Month DayOfWeek...