Why PowerShell and SharePoint 2010 Are So Cool


Anybody who has read one of my posts knows that I am a huge PowerShell geek, I tweet about it, I blog about it, I talk about it SO much at my client that my contacts at said client make me add a dollar to the “PowerShell Jar” whenever I use the word “PowerShell.” 🙂

People who don’t ‘touch’ SharePoint may not completely understand why PowerShell and SharePoint are so cool, so I wanted to put together a quick, fairly non-technical post about why they are so cool…

  1. PowerShell allows SharePoint Developers and IT Pros to automate tasks that in the past would’ve required a LOT of scripting – however, we can do it much, much quicker and easier in PowerShell.
  2. PowerShell allows SharePoint IT Pros access to something that in the past we haven’t had easy access to – the SharePoint API or Object Model. (Note: I’m not a developer so if I use a term incorrectly, forgive me. :))

#1 is fairly obvious, but #2 is really where the power comes in.  There are times when an IT Pro is administering SharePoint and he or she needs to do something that just isn’t possible in the UI or through the standard command interfaces.  Having the ability to call methods from the SP Object Model in PowerShell takes away a lot of headaches!

Example: I need to forcefully delete a service application but can’t do so because I blew away the database.  Remove-SPServiceApplication won’t work at this point because that’s the graceful way to do it and I can’t communicate with the service application database.

Resolution:

$app = Get-SPServiceApplication -Identity
$app.Delete()

That’s right, two quick lines of code and I’ve now deleted the old service application that I couldn’t delete using Remove-SPServiceApplication or through the Central Administration interface.

For other examples of using PowerShell and the Object Model to accomplish tasks that in prior (non-PowerShell-enabled) versions were not possible without code – see one of my other recent posts…

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s