Book Image

PowerCLI Cookbook

By : Philip Brandon Sellers
Book Image

PowerCLI Cookbook

By: Philip Brandon Sellers

Overview of this book

Table of Contents (19 chapters)
PowerCLI Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a snapshot management module


While running all of this from a function and using a .ps1 file works very well, there is a better way. PowerCLI users can actually take the work of a function and create their own module, just like the ones that are used when you use Import-Module in PowerShell or PowerCLI. By creating a module, you can locate this in a default PSModulePath for PowerShell and you can import it like any vendor supplied modules. You can also distribute this module to end users, help desk staff, or other administrators to ease management. By taking your function or functions to this level, you can gain portability for the code that you've created.

It is important to note that any script file with one or more functions can become a module. Each module should be a unique name, and each module will be a .psm1 file located in a directory of the same name as the file.

Getting Started

To begin this recipe, you will need a new PowerCLI window that was not used in the previous recipes...