PowerShell with a Purpose Blog

SQL Server + PowerShell: Why? You Tell Me. Please.

So, I need your help. Especially if you're a SQL Server DBA playing with PowerShell.

I've been getting a LOT of people asking me for more SQL-specific PowerShell stuff... and I'm a bit stumped. Here's the deal: SQL Server 2008 ships with a grand total of two cmdlets for PowerShell. Two. As in "2." I counted them twice.

Why? Well, I don't know for sure - but I can guess. The point of PowerShell is to (a) ensure you can administer things completely from the command-line, but to do so in a way that (b) can power a GUI interface, too. SQL Server has had that for, oh, forever in the form of the Transact-SQL language. In many ways, it's been a model for what PowerShell can and should be. SQL Server GUIs often just run T-SQL commands under the hood - you can even save the script out to a file, if you like, and run it yourself - just like the better PowerShell-powered GUIs.

So when someone went to the SQL Server team and said, "you have to make sure your product can be administered from the command-line," they probably figured "okay, mission accomplished." They really only needed to give us a simple way to execute T-SQL from within PowerShell, and one of those two cmdlets they delivered is Invoke-SqlCmd, which does that very nicely.

Most DBAs know T-SQL quite well. It's kind of a job hazard.

So here's my question: If you're a DBA...

What is it that you want to do in PowerShell that can't be accomplished by just invoking T-SQL queries?

I'm not denying for a second that there are such things... I just don't know what they are. I sit down to manage SQL and my brain goes all T-SQL automatically; I've not run into a bunch of stuff (there's a few things) that I felt I needed a dedicated PowerShell cmdlet for.

Please, please, please - drop a comment and let me know. Or if the comment system isn't working (it happens - and don't hit "submit" or refresh multiple times, cuz it winds up posting duplicates) drop me a line at my "powershell" alias at ConcentratedTech.com. Or you can use the "Contact Us" form at ConcentratedTech.com. Whatever. Help me figure out what you need to learn, and I'll work on writing it up.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish