We recommend using Visual Studio 2017

Job.Rename Method

Renames the job.

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

public void Rename(
	string newName
)

Parameters

newName
Type: System.String
A String value that specifies the new name of the job.

Implements

IRenamable.Rename(String)

The following code example demonstrates how to rename a job.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.ApplyToTargetServer(srv.Name);
jb.Rename("New Job Name");

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
$jb.Rename("New Job Name")

Community Additions

ADD
Show: