Any suggestions? Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Server::JobServer Property

 

Gets the SQL Server Agent associated with the instance of SQL Server.

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

public:
[SfcObjectAttribute(SfcObjectRelationship::Object, SfcObjectCardinality::One)]
property JobServer^ JobServer {
	JobServer^ get();
}

Property Value

Type: Microsoft.SqlServer.Management.Smo.Agent::JobServer^

A JobServer object that specifies the SQL Server Agent associated with the instance of SQL Server.

The JobServer object represents the SQL Server Agent. You can use the JobServer object to reference the SQL Server Agent jobs, operators, and alerts. SQL Server Agent settings can be viewed or modified by using the JobServer object.

Visual Basic

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$al = new-object Microsoft.SqlServer.Management.Smo.Agent.Alert($srv.JobServer, "Test Alert")
$al.PerformanceCondition = "SQLServer:General Statistics|User Connections||>|3"
$al.Create()
$op = new-object Microsoft.SqlServer.Management.Smo.Agent.Operator($srv.JobServer, "Test Operator")
$op.NetSendAddress = "NetworkPC"
$op.Create()
$al.AddNotification("Test Operator", [Microsoft.SqlServer.Management.Smo.Agent.NotifyMethods]::NetSend)
Return to top
Show:
© 2016 Microsoft