From e674fc7ea7071e2ac76b8c744a73daa355f860f1 Mon Sep 17 00:00:00 2001 From: Andreas Jordan <66946165+andreasjordan@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:12:12 +0200 Subject: [PATCH] New-DbaAgentJob: Fix wrong output when using -Force to remove existing job (#9512) --- public/New-DbaAgentJob.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 $_