Creating ad hoc commands is very useful in PowerCLI, but there are times and situations where you find yourself repeatedly doing the same tasks, or where your series of cmdlets becomes long for complex tasks. The next step is to create a PowerCLI function that can be reused and repeated. In the case of snapshot management, the function can be initiated from a single command and will run through your established procedure. This makes it easier to do your work.
You can take and store the function in a
.ps1 file that can be referenced easily. While functions are really useful, they must be defined in each new PowerCLI window, so storing them in a file eases that process.
It is also important ...