Windows PowerShell is an extendable command shell and scripting language which can be used to manage/administer server environments like Windows Server, Exchange and also SharePoint 2010.
The above PowerShell definition has two things that stick out to me: “extendable” and “scripting language”. Extendable sticks out because it means I can add value to this environment by extending it with my own tools (cmdlets) so I can:
- make repetitive tasks easier and less tedious.
- make complex tasks less complex by wrapping several commands together.
- automate some tasks like e.g. deployment which reduces the risk of human error.
Pre-PowerShell we used to do all sorts of tasks with all sorts of tools
- Central Administration website
- the SharePoint Products Configuration Wizard
Windows PowerShell 2.0 is already in Windows 7 and Server 2008 R2. If you’re not working on Windows 7 or Windows server 2008 R2 you get get instructions here. The containing folder of PowerShell 2.0 is, confusing as it may be, still named 1.0. If you’re not sure, just start up PowerShell and type “get-host”.
The cmdlets used in PowerShell are typically made up out of a verb and a noun as can be seen in the above get-host example. To help you with these cmdlets and create working scripts, Microsoft have created a tool: the Windows PowerShell Command Builder.
For people who don’t like the old-school blue command line console look, or are looking for some more advanced features, there are several third party tools available:
However, MicroSoft also ships its own Grapihical editor calle PowerShell ISE, it has some nice features:
- A Command pane for running interactive commands.
- A Script pane for writing, editing, and running scripts. You can run the entire script or selected lines from the script.
- A scrollable Output pane that displays a transcript of commands from the Command and Script panes and their results.
- Up to eight independent Windows PowerShell execution environments in the same window, each with its own Command, Script, and Output panes. This tabbed environment allows you to work on several tasks at the same time.
- Multiline editing in the Command pane lets you paste multiple lines of code, run them, and then recall them as a unit.
- A built-in debugger for debugging commands, functions, and scripts. You can set and remove breakpoints, step through your code, check the values of variables, and display a call-stack trace.
- Customizable features let you adjust the colors, font, and layout.
- A scriptable object model lets you further customize and extend Windows PowerShell ISE. You can add functionality, including menu items. Also, you can access the session, the files, and the editor to create your own features.
- Line and column numbers, keyboard shortcuts, tab completion, context-sensitive Help, and Unicode support make Windows PowerShell ISE an efficient and productive environment for using Windows PowerShell. Windows PowerShell even lets you open files by using a drag-and-drop operation.
The only setback, out of the box, it does not support SharePoint, luckily Spence Harbar has found a solution for that.
Last but not least, if you want to use PowerShell for your SharePoint online environment there are some things that need to be done, it will not work out of the box, there is a blogpost by Jeffrey Paarhuis called Scripting SharePoint Online with PowerShell using Client Object Model which will get you up and running.
With that said, I’ll leave it up to you whether you like PowerShell or not and if it’s something to further explore. Untill next time, happy SharePointing!