Skip to content

Commit

Permalink
[Set-DbaAgentJobStep] - Added ShouldProcess to the Rename to fix data…
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyBronowski committed Feb 4, 2022
1 parent d0ea48a commit d4d018e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/Set-DbaAgentJobStep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ function Set-DbaAgentJobStep {
#region job step options
# Setting the options for the job step
if ($NewName) {
Write-Message -Message "Setting job step name to $NewName" -Level Verbose
$jobStep.Rename($NewName)
if ($Pscmdlet.ShouldProcess($server, "Setting job step name to $NewName for $StepName")) {
$jobStep.Rename($NewName)
}
}

if ($Subsystem) {
Expand Down Expand Up @@ -372,9 +373,9 @@ function Set-DbaAgentJobStep {
#region job step options

# Execute
if ($PSCmdlet.ShouldProcess($server, "Changing the job step '$StepName' for job '$j'")) {
if ($PSCmdlet.ShouldProcess($server, "Committing changes for job step '$StepName' for job '$j'")) {
try {
Write-Message -Message "Changing the job step '$StepName' for job '$j' on $server" -Level Verbose
Write-Message -Message "Committing changes for '$StepName' for job '$j' on $server" -Level Verbose

# Change the job step
$jobStep.Alter()
Expand Down

0 comments on commit d4d018e

Please sign in to comment.