Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Job.CurrentRunStatus Property

Gets the current execution status of the job.

Namespace:  Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)]
public JobExecutionStatus CurrentRunStatus { get; }

Property Value

Type: Microsoft.SqlServer.Management.Smo.Agent.JobExecutionStatus
A JobExecutionStatus object value that specifies the current execution status of the job.

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

C#

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

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.CurrentRunStatus

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.