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 ...