Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm looking for a few examples of when you would be better off writing a PowerShell script vs writing a Console Application to perform some operations against the Object Model in a MOSS2007 or WSS 3.0 context.

I personally prefer writing simple Console Applications, but would like to know if I am missing out on something.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted
  1. PowerShell is a more natural fit for administrators as generally they come from a scripting background. Console apps are more natural for developers who come from a coding background.

  2. Console applications are compiled whereas PowerShell is interpreted. This means that changes can be made to scripts on the fly whereas a copy of Visual Studio is required to update a console app.

My personal use as a developer is that I sometimes use PowerShell, especially its interactive environment, to try things out and inspect objects without having to go to the effort of coding something up in Visual Studio. It's very low friction (apart from static objects, fully qualifying them is painful). However anything complex I'll turn to VS as I have access to a powerful debugger there.

share|improve this answer
    
I guess if you are not a developer, then generally you don't know the SP object model, hence you probably wouldn't be using PowerShell to access the SP Object Model. I can see the value if you do know the Object Model (developer) and you are FLUENT in PowerShell and you are analysing a problem on a (live) environment that doesn't have Visual Studio on it that it would be quite useful :) –  Jaap Vossers Nov 5 '09 at 15:50
add comment

Powershell is your friend for SharePoint, and definitely will be for 2010 (over 400 cmdlets to be released for management!). As both a developer and an IT guy, I find Powershell more comfortable as the syntax is very, very close to C# with more capability.

I use Powershell for scheduled maintenance tasks as it can call stsadm.exe commands, store that information in objects (like Site URL's or Library's), then enumerate through those objects firing other stsadm commands. As Alex mentioned as well, there are times when you need to do something against the SharePoint Object Model but can't install VS (e.g. Production).

Here's a great site that is Powershell-focused but has good resources on automating/interacting with SharePoint. http://www.powershellcommunity.org/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.