Thor Logo dbatools

Set-DbaExtendedProperty

View Source
Chrissy LeMaire (@cl), netnerds.net
Windows, Linux, macOS

Synopsis

Updates the value of existing extended properties on SQL Server database objects

Description

Updates the value of existing extended properties on SQL Server database objects. Extended properties store custom metadata like application versions, documentation, or business rules directly with database objects. This function modifies the values of properties that already exist, making it useful for maintaining application version numbers, updating documentation, or batch-modifying metadata across multiple objects.

Works with extended properties on all SQL Server object types including databases, tables, views, stored procedures, functions, columns, indexes, schemas, and many others. The function accepts extended property objects from Get-DbaExtendedProperty through the pipeline, so you can easily filter and update specific properties across your environment.

Syntax

Set-DbaExtendedProperty
    [-InputObject] <ExtendedProperty[]>
    [-Value] <String>
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaDatabase -SqlInstance localhost -Database mydb | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value "1.1.0"

Sets the value of appversion to 1.1.0 on the mydb database

Example: 2
PS C:\> Get-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value "1.1.0"

Sets the value of appversion to 1.1.0 on the mytable table of the mydb database

Required Parameters

-InputObject

Accepts extended property objects from Get-DbaExtendedProperty to update their values. Use this to pipeline specific extended properties that you want to modify.
Typically used after filtering extended properties by name, object type, or other criteria to batch update property values across multiple database objects.

PropertyValue
Alias
RequiredTrue
Pipelinetrue (ByValue)
Default Value
-Value

Specifies the new value to assign to the extended property. Accepts any string value including version numbers, descriptions, or configuration data.
Common uses include updating application version numbers, modifying documentation text, or changing configuration values stored as extended properties.

PropertyValue
Alias
RequiredTrue
Pipelinefalse
Default Value

Optional Parameters

-EnableException

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.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

PropertyValue
Aliaswi
RequiredFalse
Pipelinefalse
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

PropertyValue
Aliascf
RequiredFalse
Pipelinefalse
Default Value