posts - 218, comments - 410, trackbacks - 27

My Links

Advertisement

News

Follow billgraziano on Twitter

Article Categories

Archives

Post Categories

Consulting

SQL Server

Why am I being forced to learn PowerShell?

I spent an annoying afternoon with SQL Server 2008 today.  When we installed it on our cluster it created a job called “syspolicy_purge_history”.  I assume it does this in most installations but I haven’t checked. 

The job was generating an error every time it ran.  A quick Google search turned up an article on the problems with syspolicy_purge_history and clusters.  Now all I needed was to figure out the PowerShell syntax to correctly refer to this instance. 

PowerShell?  Oh yes.  They couldn’t just call a stored procedure.  Oh no.  Rather than giving me the choice to learn and then use PowerShell I’m being forced to wade through the syntax while troubleshooting.  I’m not exactly happy with that decision right now.  I thought this software was supposed to make me productive?  Was PowerShell really needed for this?

The KB article does a good job explaining what to do if you’re running on a named instance but there wasn’t an explanation on what to do if you’re not running on a named instance.  Technically I guess our instance was named MSSQLSERVER but that didn’t work.  It turns out you need to add the keyword DEFAULT as I did below.

(Get-Item SQLSERVER:\SQLPolicy\DBCLUSTER1\DEFAULT).EraseSystemHealthPhantomRecords()

I really hope this job truly needed PowerShell.

Print | posted on Tuesday, May 12, 2009 7:41 PM | Filed Under [ SQL Server Stuff ]

Feedback

Gravatar

# re: Why am I being forced to learn PowerShell?

Of course it needed Powershell, otherwise it wouldn't be there. Just like the Opsmgr SQL 2008 Management Pack absolutely needed to use SQL-DMO, which doesn't come with SQL 2008, you need to install it afterwards if you intend to use the management pack.

At least you get to learn something new, right? as opposed to being forced to load deprecated technology onto a new sql 2008 install.
5/12/2009 9:02 PM | SQLBatman
Gravatar

# re: Why am I being forced to learn PowerShell?

Going forward, Windows and all Server products are using PowerShell so it's worth your while to spend the time and learn it. I think you'll find it useful and powerful.

Jeffrey Snover [MSFT]
Distinguished Engineer
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
5/13/2009 7:12 AM | Jeffrey Snover
Gravatar

# re: Why am I being forced to learn PowerShell?

The Policy Based Management feature uses PowerShell for several of its features, including running Policies on SQL Server 2005 and 2000 systems. Those don't have the engine to run a Policy, so we could have either not allowed you to run a Policy down-version (I'm sure everyone would have been less than thrilled with that) or use PowerShell, which uses the SMO library to do the job.

I'm sorry you had difficulty with this - it should have been easier for you. But you DO want to learn PowerShell - it's part of hte "CEC" (common engineering criteria) that all Microsoft Server products (such as Exchange, Windows and SQL Server) have to support. This great new tool gives you the ability to manage everything in one place, in a consistent way. Hey - try it, you'll like it!

And keep posting. This is how we get better.

- Peace
5/13/2009 1:25 PM | Buck Woody
Gravatar

# re: Why am I being forced to learn PowerShell?

I'm not crazy about needing PowerShell to troubleshoot SQL install issues, but I really like PowerShell as a scripting language. I'm finding it much easier to learn & apply than PERL was.
5/15/2009 4:52 PM | Grant Fritchey
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET