Chapter 11. Windows PowerShell in SQL Server 2008 Environment, SQL Server PowerShell Provider

When installing SQL Server 2008, SQL Server installs Windows PowerShell and two SQL Server PowerShell snap-ins that expose SQL Server functionality in PowerShell. You may remember from Chapter 2 that PowerShell Snap-ins are .NET assemblies that contain Windows PowerShell providers and/or Windows PowerShell cmdlets that extend the functionality of the shell. When a snap-in is loaded into the PowerShell environment, the cmdlets and providers contained in it are registered with the shell. SQL Server 2008 installs its own snap-ins, which are covered in detail in the latter part of this chapter.

This chapter discusses the new features in SQL Server 2008 that integrate SQL Server and PowerShell:

  • sqlps utility

  • SQLSERVER: Drive and Invoke-Sqlcmd cmdlets

  • Encoding and decoding the Uniform Resource Name (URN)

sqlps Utility

The sqlps utility is included with SQL Server 2008; you don't have to install it separately. When the sqlps utility is launched, it starts a PowerShell session with the SQL Server PowerShell provider. This means that SQL Server PowerShell snap-ins and all SQL Server–related cmdlets are loaded, registered, and ready to be executed. The SQL Server PowerShell provider exposes SQL Server objects in a hierarchy similar to the file system.

In addition to sqlps, the following components are also already installed at the time of SQL Server 2008 installation:

  • .NET Framework 3.5: The SQL Server 2008 ...

Get Microsoft® SQL Server® 2008 Administration with Windows PowerShell™ 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.