May 18, 2011 at 12:43 pm
At the SQL Rally in Orlando last week, a number of presentations on Powershell got me excited about adding a new tool to my tool belt; all the presenters were demoing scripts for Powershell from within SQL Server Management Studio.
So I finally get back to my desk, rub my hands together, and .....darn.
no linky-linky or button to launch an IDE for Powershell within SSMS 2008.
I would swear the demos had a Powershell button right next to things like Show Execution plans and stuff right in the top toolbar.
I covered the basics of going through all menu items, and of course found what launches a command line version from object explorer, as well as a stand alone GUI for Start>>All Programs>>Accessories>>Windows PowerShell>>
i did downlaod SQLPSX from codeplex, but i think that installs Alaises and functionality in powershell, and not a GUI.
Anyone out there point me to a missing add on, or otherwise rub my nose in it?
Lowell
May 18, 2011 at 1:00 pm
The only ways I know of are: http://www.winserverhelp.com/2010/04/getting-started-with-powershell-for-sql-server/
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 18, 2011 at 1:38 pm
What, no mention of ISE? Imperative for PS development.
Located at %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell_ise.exe on my system. Even though it says v1.0 it actually runs against the PS 2.0 runtime. The PS dev environment is truly in disarray 🙂
On XP:
Start > Programs > Accessories > Windows PowerShell > Windows PowerShell ISE
In a new ISE Window run the stuff in option D from the article Gus linked to in order to load the SQL Server commands...reprinted here in case that article moves:
Get-PSSnapin –registered
Add-PSSnapin SqlServerProviderSnapin100
Add-PSSnapin SqlServerCmdletSnapin100
Then you can use the SQL Server commands like:
Get-Help Invoke-SqlCmd
Then you just need to make sure your script loads the commands when it starts or you need to exec your script using sqlps.exe.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 18, 2011 at 6:52 pm
There is no gui from SQL Server. It's worse than that. If you launch from SSMS, you're going to have a brain dead version of PowerShell. Better to launch it from the command line utility and load the snap-ins for SQL Server. A bunch of ways to set that up, but the basic one is BOL. Something to plan for because most IDEs won't have the snap-ins loading for you.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 18, 2011 at 9:53 pm
Grant Fritchey (5/18/2011)
There is no gui from SQL Server. It's worse than that. If you launch from SSMS, you're going to have a brain dead version of PowerShell. Better to launch it from the command line utility and load the snap-ins for SQL Server. A bunch of ways to set that up, but the basic one is BOL. Something to plan for because most IDEs won't have the snap-ins loading for you.
The best way to get an environment started with the snap-ins you like is to setup a profile for yourself.
http://msdn.microsoft.com/en-us/library/bb613488(v=vs.85).aspx
On my Win7 machine the file %windir%\system32\WindowsPowerShell\v1.0\profile.ps1 did not exist initially but I created it and added the necessary commands to load the snap-ins I care about in every shell opened on my machine, including a sqlps shell.
Now if your scripts take the pre-made environment for granted and they do not load the snap-ins themselves then you could have problems with portability...but for local dev it makes things much more comfy.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply