SQL Server includes a set of Windows PowerShell cmdlets for performing common actions in the Database Engine. In addition, Query Expressions and Uniform Resource Names (URN) can be converted to SQL Server PowerShell paths, or used to specify one or more objects in the Database Engine.
Database Engine Cmdlets
SQL Server 2016 includes relatively few cmdlets for the Database Engine. Most PowerShell scripts working with the Database Engine use the SQL Server PowerShell provider and the manageability object models. For more information, see SQL Server PowerShell Provider.
To learn how to get help about the SQL Server cmdlets in a Windows PowerShell environment, see Get Help SQL Server PowerShell.
In This Section
This section contains information about these cmdlets.
|Runs Transact-SQL and XQuery scripts, such as scripts that can be run using the sqlcmd utility.||Invoke-Sqlcmd cmdlet|
|Evaluates whether a Database Engine object complies with a Policy-based Management policy.||Invoke-PolicyEvaluation cmdlet|
Information About Other Cmdlets
The Encode-Sqlname and Decode-Sqlname cmdlets help you specify SQL Server identifiers that contain characters not supported in PowerShell paths. For more information, see SQL Server Identifiers in PowerShell.
Use the Convert-UrnToPath cmdlet to convert a Unique Resource Name for a Database Engine object to a path for the SQL Server PowerShell provider. For more information, see Convert URNs to SQL Server Provider Paths.
Query Expressions and Unique Resource Names
Query expressions are strings that use syntax similar to XPath to specify a set of criteria that enumerate one or more objects in an object model hierarchy. A Unique Resource Name (URN) is a specific type of query expression string that uniquely identifies a single object. For more information, see Query Expressions and Uniform Resource Names.