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.CurrentRunStep Property

Gets information about the job step that is currently running.

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

[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone|SfcPropertyFlags.Matrix)]
public string CurrentRunStep { get; }

Property Value

Type: String
A String value that specifies the job step that is currently running.

For executing jobs, the property reports the job step by number, and the name of the job step as a string, for example: 2 (Run Replication Agent.).

The following code example creates a new job and displays its current step.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.Create();
Console.WriteLine(jb.CurrentRunStep);

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
$jb.Create()
Write-Host $jb.CurrentRunStep

Community Additions

Show:
© 2015 Microsoft