Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 3.0 » Register-ScheduledJob

Register-ScheduledJob - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Register-ScheduledJob

Short description
Creates a new scheduled job.

Syntax
Register-ScheduledJob [-Name] <String> [-ScriptBlock] <ScriptBlock> [-ArgumentList <Object[]>] [-Authentication <Authen
ticationMechanism>] [-Credential <PSCredential>] [-InitializationScript <ScriptBlock>] [-MaxResultCount <Int32>] [-RunA
s32] [-ScheduledJobOption <ScheduledJobOptions>] [-Trigger <ScheduledJobTrigger[]>] [-Confirm] [-WhatIf] [<CommonParame
ters>]
Register-ScheduledJob [-Name] <String> [-FilePath] <String> [-ArgumentList <Object[]>] [-Authentication <Authentication
Mechanism>] [-Credential <PSCredential>] [-InitializationScript <ScriptBlock>] [-MaxResultCount <Int32>] [-RunAs32] [-S
cheduledJobOption <ScheduledJobOptions>] [-Trigger <ScheduledJobTrigger[]>] [-Confirm] [-WhatIf] [<CommonParameters>]





Description
The Register-ScheduledJob cmdlet creates scheduled jobs on the local computer.


A "scheduled job" is a Windows PowerShell background job that can be started automatically on a one-time or recurring s
chedule. Scheduled jobs are stored on disk and registered in Task Scheduler, so they can be managed in Task Scheduler o
r by using the Scheduled Job cmdlets in Windows PowerShell.


When a scheduled job starts, it creates an "instance" of the scheduled job. Scheduled job instances are identical to Wi
ndows PowerShell background jobs, except that the results are saved on disk. Use the Job cmdlets, such as Start-Job, Ge
t-Job, and Receive-Job to start, view, and get the results of the job instances.


Use Register-ScheduledJob to create a new scheduled job. To specify the commands that the scheduled job runs, use the S
criptBlock parameter; to specify a script that the job runs, use the FilePath parameter.


Windows PowerShell scheduled jobs use the same job triggers and job options that Task Scheduler uses for scheduled task
s.


The Trigger parameter of Register-ScheduledJob adds one or more job triggers that start the job. The Trigger parameter 
is optional, so you can add triggers when you create the scheduled job, add job triggers later, use the Start-Job cmdle
t to start the job immediately at any time, or save the untriggered scheduled job as a template for other jobs.


The Options parameter lets you customize the options settings for the scheduled job. The Options parameter is also opti
onal, so you can set job options when you create the scheduled job or change them at any time. Because job option setti
ngs can prevent the scheduled job from running, review the job options and set them carefully.


Register-ScheduledJob is one of a collection of job scheduling cmdlets in the PSScheduledJob module that is included in
 Windows PowerShell.


For more information about Scheduled Jobs, see the About topics in the PSScheduledJob module. Import the PSScheduledJob
 module and then type: Get-Help about_Scheduled* or see about_Scheduled_Jobs.


This cmdlet is introduced in Windows PowerShell 3.0.