2

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.

2 Answers 2

2
  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.

1
  • 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 :) Commented Nov 5, 2009 at 15:50
1

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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