Subscribe:      
 

Custom PowerShell Modules for SharePoint

Written By: Chris Beckett -- 6/7/2011 -- join -- contribute -- (1414) comments -- printer friendly version

Rating: Rate --

Categories: Configurations, PowerShell, Programming and Customizations, SharePoint 2010, SharePoint Foundation 2010, System Administration

< Prev - 1 | 2 | 3 | 4 | 5 | 6 | 7 | - Next > | Become a paid author

Problem

As SharePoint Developers and Administrators take advantage of PowerShell support in SharePoint 2010 to automate configuration and maintenance tasks they inevitably begin to run into issues. These include managing larger, more complex scripts, and sharing and managing of snippets and functions they want to reuse across the team.

Solution

In PowerShell v1, creating a custom PowerShell Snapin required Visual Studio and managed code. PowerShell v2 introduced the ability to create reusable modules written entirely in PowerShell. In essence, Modules are the new Snapins.

Some of the advantages of PowerShell modules include the follow:

  • Organizes PowerShell code into self-contained, reusable units.
  • Does not require deploying a compiled DLL or updating the Registry.
  • Supports embedded help information and the Get-Help CmdLet.
  • Defines a restricted runspace with its own context that does not affect state, outside the module.
  • Defines persistent script-scope variables that preserve their state across multiple calls.
  • Explicitly defines which members are exported as public, outside the module.
PowerShell modules are essentially like classes, with private and public variables and functions.

< Prev - 1 | 2 | 3 | 4 | 5 | 6 | 7 | - Next >



Learn more about SharePoint



Sponsor Information




Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


MSSharePointTips.com | MSSQLTips.com