Admittedly, I was not too excited to learn I would need to add yet another new technology skillset when I first learned SharePoint 2010 would include a PowerShell management interface.  Most of us are behind on our bucket list of new technologies to master as it is…

Fortunately, after biting the bullet and diving in, I have been pleasantly surprised that it is relatively easy with a few commands and techniques to enjoy the power and capabilities of the SharePoint 2010 Management Shell (i.e. PowerShell).  I am by no means now a PowerShell guru, but the basics I’ve laid out below will get you well on your way to (gulp) using PowerShell as a SharePoint Administrator:

  1. PowerShell cmdlets take on a verb-noun naming convention
    1. get-SPWeb <–”gets” a SPWeb (i.e. child/sub site) object and all of its properties

For more general information on using Windows Powershell, start with the following resources, which are included in the tool:

 

  • Getting Started. A brief introduction and tutorial. To open it, click Start, All Programs, Windows PowerShell 1.0, and then click Getting Started
  • User Guide. A detailed introduction, including real-world scripts and scenarios to get you started.
  • Get-Help cmdlet. A Windows PowerShell™ cmdlet that you can use to quickly learn about the cmdlets and providers on your system. To begin, start Windows PowerShell™, and at the prompt, type: 

    get-help

    To learn about the Windows PowerShell scripting language and other concepts, read the “about” topics. To see a list of “about” topics, type

    get-help about

  1. To load all of the SharePoint 2010 cmdlets, make sure to open the SharePoint 2010 Management Shell (and not the tempting standard Windows PowerShell interface)


  2. Use the TAB key to get the exact names of cmdlets
    1. For example, if you looking for the correct backup cmdlet name, type in
      get-help backup-SP
      and hit the TAB key to scroll through the cmdlets that match your string up to that point


      <TAB>

      <TAB>

  3. SharePoint 2010 cmdlets have “noun” that starts with SP
    1. Use the get-help or get-command and wildcard (*) to find the cmdlets you are looking for
      1. Example 1:
        1. Get-help *SP* [lists out all SharePoint 2010 cmdlets] 

         

      2. Example 2:
        1. Get-help *SP*WebApplication* 

         

  4. Use “get-help” to get to know the cmdlets and also to get examples!
    1. Example 1:
      1. get-help backup-SPSite -examples 


    2. Example 2:
      1. get-help backup-SPSite -full

       

    3. Example 3:
      1. get-help backup-SPSite -detail 


  5. Use variables to store your returned objects and reuse them
    1. Example:  

      >Start-SPAssignment -Global
      >$w = Get-SPWeb http://sitename
      >$w.set_SiteLogoUrl(http://PathToImage/test.jpg)
      >$w.Update()
      >Stop-SPAssignment -Global 

  6. For more advanced Windows PowerShell examples, refer to the following references:
Link Description
Windows PowerShell Team Blog The best resource for learning from and collaborating with other Windows PowerShell™ users. Read the Windows PowerShell Team blog, and then join the Windows PowerShell User Forum (microsoft.public.windows.powershell). Use Windows Live Search to find other Windows PowerShell blogs and resources. Then, as you develop your expertise, please freely contribute your ideas.
Windows PowerShell SDK Provides reference content used to develop cmdlets, providers, and hosting applications.
Windows PowerShell Programmer’s Guide Provides tutorials for creating cmdlets, providers, and hosting applications. Also contains information about fundamental Windows PowerShell concepts.
Windows PowerShell Cmdlets Gallery in Bing Visual Search A visual display of Windows PowerShell cmdlets that you can search, sort, and filter.

SharePoint 2010 PowerShell References

Related posts:

  1. Migrating MOSS 2007 SSP/MySites to SharePoint 2010 in a database attach scenario So you have decided to upgrade your MOSS 2007 farm to SharePoint 2010.  You’ve reviewed...
  2. SharePoint 2010 Links and Resources Here are some SharePoint 2010 links I’ve collected so far…...
  3. Deleting orphaned service (web) application pools in SharePoint 2010 This has come up for me twice this week.  During an initial install a typo...
  4. Channel 9 SharePoint 2010 Developer Videos Channel 9 SharePoint 2010 Developer Videos...
  5. Contribute to the SharePoint 2010 SDK! Anyone who worked with MOSS 2007 and WSS 3.0 in its early release state noticed...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>