| title | Import the SQLPS Module | Microsoft Docs |
|---|---|
| ms.custom | |
| ms.date | 03/08/2017 |
| ms.prod | sql-server-2014 |
| ms.reviewer | |
| ms.technology | database-engine |
| ms.topic | conceptual |
| ms.assetid | a972c56e-b2af-4fe6-abbd-817406e2c93a |
| author | mashamsft |
| ms.author | mathoma |
| manager | craigg |
The recommended way to manage [!INCLUDEssNoVersion] from PowerShell is to import the sqlps module into a Windows PowerShell 2.0 environment. The module loads and registers the [!INCLUDEssNoVersion] snap-ins and manageability assemblies.
-
Before You Begin: Security
-
To load the module: Load the sqlps Module
After importing the sqlps module into Windows PowerShell, you can then:
-
Interactively run Windows PowerShell commands.
-
Run Windows PowerShell script files.
-
Run [!INCLUDEssNoVersion] cmdlets.
-
Use the [!INCLUDEssNoVersion] provider paths to navigate through the hierarchy of [!INCLUDEssNoVersion] objects.
-
Use the [!INCLUDEssNoVersion] manageability object models (such as Microsoft.SqlServer.Management.Smo) to manage [!INCLUDEssNoVersion] objects.
Note
The verbs used in the names of two SQL Server cmdlets (Encode-Sqlname and Decode-Sqlname) do not match the approved verbs for Windows PowerShell 2.0. This has no effect on their operation, but Windows PowerShell raises a warning when the sqlps module is imported to a session.
By default, Windows PowerShell runs with the scripting execution policy set to Restricted, which prevents running any Windows PowerShell scripts. To load the sqlps module, you can use the Set-ExecutionPolicy cmdlet to enable running signed scripts, or any scripts. Only run scripts from trusted sources, and secure all input and output files using the appropriate NTFS permissions. For more information about enabling Windows PowerShell scripts, see Running Windows PowerShell Scripts.
-
Use the
Set-ExecutionPolicycmdlet to set the appropriate script execution policy. -
Use the
Import-Modulecmdlet to import the sqlps module. Specify theDisableNameCheckingparameter if you want to suppress the warning aboutEncode-SqlnameandDecode-Sqlname.
This example loads the sqlps module with name checking turned off.
## Import the SQL Server Module.
Import-Module "sqlps" -DisableNameChecking SQL Server PowerShell
SQL Server PowerShell Provider
Use the Database Engine cmdlets