Wednesday, February 20, 2008

SQL Server 2008 & PowerShell - Better Together

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

..."

Nice!

I dig how PowerShell is being truly integrated, not just bolted on as an after thought, into MS Server products (having a plan or directive to do it and seeing it happen are two different things as we all know...).

I've been skipping the SQL 2008 CTP's (there a VM with it on it?), but when it goes RC I'm going to take a nice long look at it. (I only have so many mental cycles [stupid neurons, fire faster!...] and we're just starting our SQL 2005 move... sigh...)

No comments: