Install SQL Server PowerShell

SQL Server Setup automatically configures PowerShell components.

You install the software that provides SQL Server support for Windows PowerShell by using SQL Server Setup. When you select any SQL Server features that require PowerShell support, Setup installs the following SQL Server PowerShell components:

  • The SQL Server PowerShell snap-ins. The snap-ins are dll files that implement two types of Windows PowerShell support for SQL Server:

    • A set of SQL Server 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 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 module that is imported into Windows PowerShell sessions to load the SQL Server snap-ins.

  • SQL Server Management Studio supports starting Windows PowerShell sessions from the Object Explorer tree. SQL Server Agent supports Windows PowerShell job steps.

Windows Server 2012 and later and Windows 8 and later come with PowerShell installed and configured. For information about installing Windows PowerShell see Installing Windows PowerShell.

For more information, see: