Author | Sander Stad (@sqlstad), sqlstad.nl |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Set-DbaAgentJobCategory on GitHub.
Want to see the Bill Of Health for this command? Check out Set-DbaAgentJobCategory.
Renames SQL Server Agent job categories to standardize naming conventions across instances.
Renames existing SQL Server Agent job categories by updating their names in the msdb database. This is particularly useful for standardizing job category naming conventions across multiple environments or correcting categories that were created with inconsistent names. The function validates that source categories exist and prevents renaming to names that already exist, helping maintain clean job organization within SQL Server Agent.
Set-DbaAgentJobCategory
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Category] <String[]>]
[[-NewName] <String[]>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> New-DbaAgentJobCategory -SqlInstance sql1 -Category 'Category 1' -NewName 'Category 2'
Change the name of the category from 'Category 1' to 'Category 2'.
PS C:\> Set-DbaAgentJobCategory -SqlInstance sql1, sql2 -Category Category1, Category2 -NewName cat1, cat2
Rename multiple jobs in one go on multiple servers.
The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies the existing job category name(s) to rename. The category must already exist in the SQL Server Agent on the target instance.
Use this to identify which job categories need standardized naming across your environment.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies the new name(s) for the job category. The new name cannot already exist on the target instance.
When renaming multiple categories, provide names in the same order as the Category parameter values.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Bypasses confirmation prompts and performs the rename operation without asking for user confirmation.
Use this when scripting bulk category renames where manual confirmation would be impractical.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |