Get-SqlColumnEncryptionKey

Gets all column encryption key objects defined in the database, or gets one column encryption key object with the specified name.

Syntax

Get-SqlColumnEncryptionKey
   [[-Name] <String>]
   [-InputObject] <Database>
   [-Script]
   [<CommonParameters>]
Get-SqlColumnEncryptionKey
   [[-Name] <String>]
   [[-Path] <String>]
   [-Script]
   [<CommonParameters>]

Description

The Get-SqlColumnEncryptionKey cmdlet returns a column encryption key object for each column encryption key in the target database.

If the name of the column encryption key is provided, the cmdlet returns one specific column encryption key object.

Examples

Example 1: Get all column encryption keys from a database

PS C:\> Get-SqlColumnEncryptionKey

This command gets all column encryption keys from the database.

Example 2: Get a column encryption key from a specified

PS C:\> Get-SqlColumnEncryptionKey -Name "CEK1"

This command gets a column encryption key from the column encryption key object named 'CEK1'.

Parameters

-InputObject

Specifies the SQL database object for which this cmdlet runs the operation.

Type:Database
Position:2
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Specifies the name of the column encryption key object.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Path

Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Script

Indicates that this cmdlet runs a script to get the SQL column encryption key value.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.SqlServer.Management.Smo.Database

Outputs

SqlColumnEncryptionKey[]

SqlColumnEncryptionKey