13 Mar 2009

How to dot-source a powershell script

Have you ever been interested to include (to dot source) another powershell script into your own one?

It’s as simpe as this post: just decide where to include the script (typically at the beginning).
Add the following line:

. C:\somepath\somepowershellscript.ps1

that’s all. you now have access to all functions defined in the source script.
Use this method to include my “globalfunctions.ps1” which includes a lot of useful functions… and it’s even growing all days 🙂