Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Job.JobSteps Property


Applies To: SQL Server 2016 Preview

Gets a collection of JobStep objects that represent the job steps defined for the job.

Namespace:   Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

	SfcContainerCardinality.ZeroToAny, typeof(JobStep))]
public JobStepCollection JobSteps { get; }

Property Value

Type: Microsoft.SqlServer.Management.Smo.Agent.JobStepCollection

A JobStepCollection object value that specifies a collection of JobStep objects.

Legacy Code Example

The following code example creates a job and an associated job step.


Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
JobStep jbstp = new JobStep(jb, "Test Job Step");
jbstp.OnSuccessAction = StepCompletionAction.QuitWithSuccess;
jbstp.OnFailAction = StepCompletionAction.QuitWithFailure;


$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job23", 3)
$jbstp = new-object Microsoft.SqlServer.Management.Smo.Agent.JobStep($jb, "Test Job Step")
$jbstp.OnSuccessAction = [Microsoft.SqlServer.Management.Smo.Agent.StepCompletionAction]::QuitWithSuccess
$jbstp.OnFailAction = [Microsoft.SqlServer.Management.Smo.Agent.StepCompletionAction]::QuitWithFailure
Write-Host $jb.JobSteps
Return to top
© 2015 Microsoft