Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2010-05-13 : 11:33:07
|
how can i run a ps-power shell file from SQL2005/2008?ThanksPeleg |
|
vmenon
Starting Member
17 Posts |
Posted - 2010-05-14 : 01:14:06
|
You can refer to article http://technet.microsoft.com/en-us/library/cc281962.aspxUsing Windows PowerShell in SQL Server Management Studio: You can start Windows PowerShell sessions in SQL Server Management Studio by right-clicking objects in Object Explorer and selecting Start PowerShell. SQL Server Management Studio then starts a Windows PowerShell session in which the SQL Server 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 AdventureWorks database object in Object Explorer and select Start PowerShell, the Windows PowerShell path is set to the following:SQLSERVER:\SQL\MyComputer\MyInstance\Databases\AdventureWorks>Using the sqlps Utility: sqlps is a utility that creates a Windows PowerShell environment and then loads and registers the SQL Server snap-ins. You can use sqlps to: Interactively run Windows PowerShell commands; Run Windows PowerShell script files; Run SQL Server cmdlets; Use the SQL Server provider paths to navigate through the hierarchy of SQL Server objectsBy default, sqlps runs with the scripting execution policy set to Restricted, which prevents running any Windows PowerShell scripts. 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. |
 |
|
|
|
|