From 3347948db0014f875116407f5ea866fd1389d68a Mon Sep 17 00:00:00 2001 From: andreasjordan Date: Mon, 14 Oct 2024 19:25:37 +0200 Subject: [PATCH] suppress output of Remove (do New-DbaAgentJob) --- 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 $_