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 create a custom CmdLet, we will be using Visual Studio 2010 Professional. If you're using the virtualized environment we downloaded in the recipe, Setting up your Virtual Machine and running a test script, Visual Studio 2010 Professional will already...