Freigeben über


Job.OriginatingServer-Eigenschaft

Gets the name of the server that is acting as the master server in a multiserver job.

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

Syntax

'Declaration
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public ReadOnly Property OriginatingServer As String 
    Get
'Usage
Dim instance As Job 
Dim value As String 

value = instance.OriginatingServer
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public string OriginatingServer { get; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property String^ OriginatingServer {
    String^ get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member OriginatingServer : string
function get OriginatingServer () : String

Eigenschaftswert

Typ: System.String
A String value that specifies the name of the master server where the job definition originates from.

Hinweise

The property returns the string (local) for jobs created on the referenced instance of Microsoft SQL Server. For jobs assigned to the referenced instance of SQL Server by another server acting as a master server, the property returns the master server name.

Beispiele

The following code example creates a job and displays the name of originating server.

C#

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

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

Siehe auch

Verweis

Job Klasse

Microsoft.SqlServer.Management.Smo.Agent-Namespace

Andere Ressourcen

Automatisierte Administrationstasks (SQL Server-Agent)

sp_add_job (Transact-SQL)

Planen von automatischen, administrativen Tasks im SQL Server-Agent