dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Set-DbaAgentJobStep

Set-DbaAgentJobStep updates a job step in the SQL Server Agent with parameters supplied.

Screenshots

dbatools - Set-DbaAgentJobStep

Examples

Changes the name of the step in “Job1” with the name Step1 to Step2.

Set-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1 -NewName Step2

Changes the database of the step in “Job1” with the name Step1 to msdb.

Set-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1 -Database msdb

Changes job steps in multiple jobs with the name Step1 to msdb.

Set-DbaAgentJobStep -SqlInstance sql1 -Job Job1, Job2 -StepName Step1 -Database msdb

Changes job steps in multiple jobs on multiple servers with the name Step1 to msdb.

Set-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1, Job2 -StepName Step1 -Database msdb

Changes the database of the step in “Job1” with the name Step1 to msdb for multiple servers.

Set-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1 -StepName Step1 -Database msdb

Changes the database of the step in “Job1” with the name Step1 to msdb for multiple servers using pipeline.

sql1, sql2, sql3 | Set-DbaAgentJobStep -Job Job1 -StepName Step1 -Database msdb

Author

This command was created by Sander Stad. You can find Sander on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help Set-DbaAgentJobStep -Detailed for more information on this function.

Source Code

Want to see the source code? View Set-DbaAgentJobStep.ps1 on GitHub
 

Related commands