diff --git a/public/New-DbaAgentJob.ps1 b/public/New-DbaAgentJob.ps1 index c5a6480fc4..f0e6da53ff 100644 --- a/public/New-DbaAgentJob.ps1 +++ b/public/New-DbaAgentJob.ps1 @@ -250,7 +250,7 @@ function New-DbaAgentJob { if ($PSCmdlet.ShouldProcess($instance, "Removing the job $Job on $instance")) { try { - Remove-DbaAgentJob -SqlInstance $server -Job $Job -EnableException -Confirm:$false + $null = Remove-DbaAgentJob -SqlInstance $server -Job $Job -EnableException -Confirm:$false $server.JobServer.Refresh() } catch { Stop-Function -Message "Couldn't remove job $Job from $instance" -Target $instance -Continue -ErrorRecord $_