| title | Run Windows PowerShell from SQL Server Management Studio | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 03/14/2017 | |
| ms.prod | sql-server-2016 | |
| ms.reviewer | ||
| ms.suite | ||
| ms.technology |
|
|
| ms.tgt_pltfrm | ||
| ms.topic | article | |
| ms.assetid | 1f841825-da1f-4062-9a81-3cdbab03845b | |
| caps.latest.revision | 11 | |
| author | JennieHubbard | |
| ms.author | jhubbard | |
| manager | jhubbard |
You can start Windows PowerShell sessions from Object Explorer in [!INCLUDEssManStudioFull]. [!INCLUDEssManStudio] launches Windows PowerShell, loads the sqlps module, and sets the path context to the associated node in the Object Explorer tree.
When you specify running PowerShell for an object in Object Explorer, [!INCLUDEssManStudioFull] starts a Windows PowerShell session in which the [!INCLUDEssNoVersion] PowerShell snap-ins have been loaded and registered. The path for the session is preset to the location of the object you right clicked in Object Explorer. For example, if you right-click the [!INCLUDEssSampleDBobject] database object in Object Explorer and select Start PowerShell, the Windows PowerShell path is set to the following:
SQLSERVER:\SQL\MyComputer\MyInstance\Databases\AdventureWorks2012>
To run PowerShell from SQL Server Management Studio
-
Open Object Explorer.
-
Navigate to the node for the object to be worked on.
-
Right-click the object and select Start PowerShell.
When opened from [!INCLUDEssManStudio], PowerShell does not run with Administrator privileges which may prevent some activities such as calls to WMI.