The RemoveFromTargetServerGroup method drops one or more execution targets for a SQL Server Agent job.
object.RemoveFromTargetServerGroup( Val )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list |
Val | String specifying a single TSX group by name. |
Before a SQL Server Agent job can execute, the job must have at least one step and an execution target. When SQL Server Agent acts as a master server (MSX) for multiserver administration servers, known execution targets servers(TSX) can be grouped for easier targeting of multiple servers at one time.
When using SQL-DMO to create, schedule, and run SQL Server Agent jobs, use either the ApplyToTargetServer or ApplyToTargetServerGroup method to add an execution target. When one or more TSXs have been targeted by using the ApplyToTargetServerGroup method, use the RemoveFromTargetServerGroup method to remove the group execution target.
For more information about configuring TSX groups by using SQL-DMO, see TargetServerGroup Object.
Note When a group execution target is removed for a multiserver administration job, the MSX posts job-delete instructions to all TSXs named in the group. The job is removed from grouped TSXs, but remains defined at the MSX. To completely remove a job from all servers participating in multiserver administration, use a job removing method such as the Remove method of the Job object or the RemoveJobByID method of the JobServer object.
HRESULT RemoveFromTargetServerGroup(
SQLDMO_LPCSTR NewVal);