IN THIS CHAPTER
Introduction to PowerShell and PowerShell Scripting
Using PowerShell with SMO to automate SQL Server administration
Using PowerShell to extract SQL Server data
New SQL Server 2008 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 most of the .NET Framework and the objects available within it. PowerShell is available as a free download from Microsoft at
www.microsoft.com/powershell/. It's also automatically installed when SQL Server 2008 is installed, unless it's already present. 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 will not 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 limited functionality, and significant security problems. It was easy using batch files to "hijack" actual operating system commands by creating a batch file with the same name and placing ...