What is PowerShell and why should I use it?

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.
Secondly “scripting language” gets my attention because I am a developer. When doing a bit more research on the scripting language I find that it is based on C# en build on top of and integrated with the .Net framework. So for me as a developer it is easy to learn. 

Pre-PowerShell we used to do all sorts of tasks with all sorts of tools 

  • Central Administration website
  • the SharePoint Products Configuration Wizard
  • stsadm
  • psconfig
These can all be replaced by PowerShell.

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

Windows PowerShell get-host

Windows PowerShell 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.
PowerShell ISE

PowerShell ISE

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!

HowTo: Create and Delete a SharePoint list

Audience

This post is for SharePoint beginners. One of the core elements of SharePoint is the list. A list in SharePoint is like a table in a database or a sheet in Excel. So basically any data you want to store in SharePoint you store in lists. Lists can be created using a template which give you predefined columns and list settings or you can design a list by creating a custom list.

Steps to create a list:

  1. Navigate to the site on which you want to create the new list (you must be in the right role to do this e.g. “site owner”).
  2. Click “Site Actions” in the upper left corner.
  3. Choose “More options”
  4. The “Create” screen appears.
    Create Screen SharePoint 2010

    HowTo Create a List

  5. In the “Filter By” menu select “list”.
  6. Choose the template that fits your needs.
  7. On the right hand side of the screen, type a name that describes the list and click “create”.
Alternative route:
Replace step 2 in the above instructions by clicking “Lists” in the Quickstart menu on the left of your site. You’ll get an overview of all the existing lists. In the upper left corner of this screen there is a “create button” this will also open the Create menu.
 
Congrats, you’ve just created a list. The list can now be found in the Quickstart menu on the left of your site.
 
Ok, so we’ve created a list, the next step is to delete a list. Deleting a list might not be something you will be doing on a daily basis but when you are learning SharePoint it can be a handy little thing to know as you’ll probably be adding several lists for testing purposes.
 

Steps to delete a list:

  1. Navigate to the site on which hosts the list which you want to delete (you must be in the right role to do this e.g. “site owner”).
  2. In the Quickstart menu (on the left of your site) click on the listname of the list you want to delete.
  3. By clicking the list in step two the Ribbon contect menu called “List Tools” wille be displayed (make sure the “List” option is selected, in the dark blue bar in the top of your window)
    Ribbon List Tools context menu

    Ribbon

  4. In the Ribbon choose “List Settings” this opens the list settings menu.
  5. The list settings menu shows a lot of properties and options, choose “delete this list” in the “permissions and management” category (located somewhere in the center of your screen).
    List Settings Deleting a list

    List Settings Deleting a list

  6. Confirm that you want to “move the list to the recycle bin” which, of course, sends the list to the recycle bin.
The recycle bin is very much like the recycle bin in Windows, it holds all your deleted items, it is located in the Quickstart menu, clicking on it gives you the option so recover deleted items or permanently delete them.
 

SharePoint versions 

  • SharePoint 2010 Foundation
  • SharePoint 2010 Standard Edition
  • SharePoint 2010 Enterprise Edition
  • SharePoint 2010 Online (Office 365 Edition)

Permission level

  • Design
  • Full Control
 
This concludes this HowTo. for now Happy SharePointing, live long and prosper.