Call a function from file in Windows Powershell

In order to call a function from a powershell file we have to use a method called dot-sourcing.

Let's say we have file called a.ps1 and it's contents are:

function f

    echo "Hi!!!"

And now we want to call that function from powershell. We have to load that file (think of a library):
. .\a.ps1 (that's dot, space, path-to-file) and then we can call the function itself.

This can be very usefull if you have many functions in your profile file and you don't want it to get very big.

Popular posts from this blog

Syslog Message Collection for OMS from sources that do not support the agent

How to Configure Message Forwarding on a Mailbox Level

IIS Client Certificate Revocation Check Disable