THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Allen White

Start PowerShell in Management Studio

In the February CTP of SQL Server 2008 a new feature has appeared in SQL Server Management Studio. You now have the ability to right-click on an object in the Object Explorer window and open up a PowerShell window. In this window you can navigate the database structures much like you can a disk file subsystem, or like you can navigate the registry in PowerShell.

So, let's say you right-click on your server name and open up a PowerShell window. You can then issue the command:

cd Databases/AdventureWorks

Now you're pointing to the AdventureWorks database. Using PowerShell in this way allows you to browse the Server Management Objects (SMO) tree structures. (By the way, you'll have to remember to use proper case when browsing the SMO objects. They are case-sensitive in this environment.) Now, you can type this:

dir Tables

What returns is a list of the tables in AdventureWorks. It's kind of neat idea, and definitely fun to play with. I haven't found a productive use for it yet, but it's too new for me to make a judgement yet. I like it, but I don't yet know why.

Let me know what you think.


Published Wednesday, February 20, 2008 8:59 AM by AllenMWhite



andyleonard said:

Holy smokes. This is way cool. That's what I think!

:{> Andy

February 20, 2008 8:57 AM

andyleonard said:

Oh, and another thing: So much for the SQL Server 2008 == SQL Server 2005 R2 comments...



February 20, 2008 8:58 AM

Linchi Shea said:


Why is this way cool?

February 20, 2008 10:48 AM

alphatross said:

Why is this way cool? Hey Linchi, being the guy who wrote one of my all time fave books "Real World SQL Server Administration With Perl", I'm still hoping you'll one-day do a future version with Powershell as the scripting language, to save me having to port your Perl scripts to Powershell! :)  It's more likely that Powershell will be available on Windows systems in cases where ActiveState Perl is not permitted to be installed, and I think the ability to drop to a Powershell prompt from the GUI offers increased flexibility. For example, try filtering display of SQL Agent Jobs from the GUI based on Category instead of Name (in 2005 at least, haven't tried this in 2008), it'll be nice to be able to do this via Powershell in the context of the connected server. I guess it just allows you to do things that Microsoft didn't include in the GUI.

February 21, 2008 7:42 AM

ram said:

NIce feature

May 27, 2009 9:50 AM

sokolah974 said:

But because of powershell one cannot install sql server management studio express 2008 r2 on windows 7 home edition !!!!!!

January 30, 2011 5:16 AM
New Comments to this post are disabled

About AllenMWhite

Allen White is a consultant and mentor for Upsearch Technology Services in Northeast Ohio. He has worked as a Database Administrator, Architect and Developer for over 30 years, supporting both the Sybase and Microsoft SQL Server platforms over that period.

This Blog


Privacy Statement