To create reusable code, simply turn your PowerShell code into Functions, then export these functions to your own PowerShell modules. It is really easy with ISESteroids. Here is a complete tutorial for you:
What’s Cool About Automatic Function and Module Generation?
Whenever you come across useful code – whether you found it via Google, or created it yourself – make it reusable. It takes only a click or two to wrap code into a PowerShell function, effectively turning the code into a new command.
Once you have a function, export it to a module. Any module located in any of the folders listed in $env:PSModulePath are automatically detected by PowerShell. So all functions exported to a PowerShell module will be available anywhere in your PowerShell ecosystem – and you can share them with your colleagues and customers, too.