Creating a custom PowerShell command (CmdLet)
In this chapter, previous recipes have tackled accessing custom functions in other SharePoint libraries, and using those functions to perform various operations in our script. It's now time for us to see how we can create our own custom function executing some custom logic. Once the command has been created, it will be accessible from within PowerShell for users to call.
This is particularly handy when you're creating a collection of functions which perform frequent administrative tasks on your server.
Another example where you might want to create your own CmdLet is when you're planning to package those as custom offering for your customers to download and use on their environments.
Getting ready
To ...
Get Microsoft SharePoint 2010 Developer Compendium now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.