
Installing SQL Server PowerShell Support
You install the software required to run SQL Server PowerShell scripts by using SQL Server Setup. SQL Server 2008 Setup installs the following PowerShell components when you select either the client software or the Database Services nodes:
-
Windows PowerShell 1.0, if PowerShell is not already present on your computer.
-
The SQL Server PowerShell snap-ins. The snap-ins are dll files that implement two types of PowerShell support for SQL Server:
-
A set of SQL Server PowerShell cmdlets. Cmdlets are commands that implement a specific action. For example, Invoke-Sqlcmd runs a Transact-SQL or XQuery script that can also be run by using the sqlcmd utility, and Invoke-PolicyEvaluation reports whether SQL Server objects comply with policy-based management policies.
-
A SQL Server PowerShell provider. The provider lets you navigate the hierarchy of SQL Server objects using a path similar to a file system path. Each object is associated with a class from the SQL Server Management object models. You can use the methods and properties of the class to perform work on the objects. For example, if you cd to a databases object in a path, you can use the methods and properties of the Microsoft.SqlServer.Managment.SMO.Database class to manage the database.
-
The sqlps utility that is used to run PowerShell sessions that include the SQL Server snap-ins.
The SQL Server 2008 version of SQL Server Management Studio supports starting PowerShell sessions from the Object Explorer tree. The SQL Server 2008 version of SQL Server Agent supports PowerShell job steps.
If PowerShell is uninstalled after Setup finishes, the SQL Server PowerShell features will not function. PowerShell can be uninstalled by Windows users, and uninstalling PowerShell might be required by some Windows operating system upgrades. If PowerShell has been uninstalled and you want to use the SQL Server PowerShell features, you must do one of the following:
-
Manually download and reinstall PowerShell 1.0 from the Microsoft Download Center. Download instructions are on the Windows Server 2003 Web site.
-
If you are running Windows Server 2008, PowerShell 1.0 exists in the operating system but is disabled by default. You can re-enable PowerShell from Windows Server 2008.