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]
 [-InformationAction <ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]
Get-SqlColumnEncryptionKey [[-Name] <String>] [[-Path] <String>] [-Script]
 [-InformationAction <ActionPreference>] [-InformationVariable <String>] [<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

-Name

Specifies the name of the column encryption key object.

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

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

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

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

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

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Type:ActionPreference
Aliases:infa
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Required:False
Position:Named
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
Required:False
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

SqlColumnEncryptionKey[] or SqlColumnEncryptionKey