Copy-DbaAgentJob - Add -NewName parameter to allow copying jobs to sa…#10371
Open
frodr1k wants to merge 1 commit into
Open
Copy-DbaAgentJob - Add -NewName parameter to allow copying jobs to sa…#10371frodr1k wants to merge 1 commit into
frodr1k wants to merge 1 commit into
Conversation
…me server Adds a -NewName parameter that allows copying a job under a different name. When source and destination are the same server, -NewName is required. Cannot be used when copying multiple jobs simultaneously. (do Copy-DbaAgentJob)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…me server
Adds a -NewName parameter that allows copying a job under a different name. When source and destination are the same server, -NewName is required. Cannot be used when copying multiple jobs simultaneously.
(do Copy-DbaAgentJob)
Summary
Added -NewName parameter to Copy-DbaAgentJob to allow copying a job under a different name, including to the same server.
Why
It was not possible to copy a job to the same server instance since all jobs on a server must have unique names. Users needed a way to create job copies/variants — similar to how -NewName already works in Copy-DbaDatabase. For example Ole Hallengrens Backup-command allows a parameter named "DatabasesInParallel" which needs the backupjobs to be identical. Hence this avoids typos.
Changes
Added -NewName parameter that sets the destination job name
Copying to same server now requires -NewName (fails with clear error otherwise)
-NewName cannot be used when copying multiple jobs simultaneously
Updated parameter validation test and added 3 integration tests
Testing
Verified manually against SQL Server instance. Integration tests added for same-server copy, cross-server rename, and error case without -NewName.
Closes #10370