O'Reilly logo

SQL Server 2012 with PowerShell V3 Cookbook by Donabel Santos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up Transparent Data Encryption (TDE)

This recipe shows how you can set up Transparent Data Encryption using PowerShell and SMO.

Getting ready

In this recipe, we will enable Transparent Data Encryption (TDE) on the TestDB database. If you don't already have this test database, log in the SQL Server Management Studio and execute the following T-SQL code:

IF DB_ID('TestDB') IS NULL
CREATE DATABASE TestDB
GO

You must already have a database master key for this TestDB database. If not, create it using the Creating a database master key recipe.

How to do it...

These are the steps to set up Transparent Data Encryption (TDE) programmatically:

  1. Open the PowerShell console by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required