dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Copy-SqlJob may be duplicating actions

Open dansqldba opened this issue 10 years ago • 2 comments

During testing for PR #133 I noticed the -Whatif output seemed to be duplicating.

What if: Performing the operation "Creating Job Some Report Job" on target "somesqlserver". What if: Performing the operation "Creating Job Some Report Job" on target "somesqlserver". What if: Performing the operation "Showing finished message" on target "console".

Without the WhatIf (still including -Verbose, easier to see when you remove the Write-Verbose $sql line, otherwise verbose outputs all the SQL used):

VERBOSE: Performing the operation "Creating Job Some Report Job" on target "somesqlserver". Copying Job Some Report Job VERBOSE: Performing the operation "Creating Job Some Report Job" on target "somesqlserver". Disabling Some Report Job on somesqlserver VERBOSE: Performing the operation "Showing finished message" on target "console". Job migration finished

dansqldba avatar Aug 16 '16 13:08 dansqldba

Something I observed when using Copy-SqlJob. I was using the -DisableOnDestination flag and when I used -WhatIf, I got two messages for each action. However, when I ran the actual migration, I only got one actual execution. So it might just be how the -WhatIf info is being displayed.

MikeFal avatar Aug 16 '16 19:08 MikeFal

The issue was with the $Pscmdlet.ShouldProcess messaging for the Disable block. Fixed in #142.

MikeFal avatar Aug 16 '16 21:08 MikeFal