Chapter 30

Configuring and Managing SQL Server with PowerShell

In This Chapter

Introduction to PowerShell and PowerShell Functions

Avoiding the SMO While Using PowerShell to Automate SQL Server Administration

Using PowerShell to Extract SQL Server Data

New SQL Server 2012 PowerShell Features

PowerShell is the new scripting environment for the Microsoft Windows platform. For administrators who don't have access to the Visual Studio environment, or for the IT professional who prefers scripting to compiled code, PowerShell provides access to the .NET Framework and the objects available within it. PowerShell is part of the operating system for Windows Server 2008, Windows Server 2008 R2, and Windows Server 2012. It's also available as a free download from Microsoft at www.microsoft.com/powershell/. SQL Server 2012 comes with a Provider and 40 cmdlets automatically installed when SQL Server Management Studio 2012 is installed. PowerShell is included with the Windows Server 2008 and later operating systems but must be installed on Windows 2003, Windows XP (SP2 or later), and Windows Vista. It cannot run on operating systems earlier than those mentioned here.

PowerShell was introduced in late 2006 to enable administrators to develop scripts for automating processes they did regularly. Prior to the introduction of PowerShell, most administrators used command-line batch files, VBScript, or some third-party proprietary application designed for this function.

Batch files had somewhat ...

Get Microsoft SQL Server 2012 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.