You have to understand that a function is meant to be run *by something else.* With that in mind, it’s probably easiest to save your functions into a script module. That’s just saving them into a file that’s the proper path, and giving the file the .psm1 filename extension. One module can hold many functions, and you’ll be able to run them just like a PowerShell command – no path or anything needed.
If you need to use the function from within a scheduled task, make sure the function is in a module on whatever machine will run the task. Write a script that calls the function, and schedule the script.
If you don’t need the function to be a function, then put it in a script by itself and remove the function keyword, function name, and opening and closing curly brackets.
This is all pretty well laid-out in “Learn PowerShell Toolmaking in a Month of Lunches,” along with a lot of other suggestions for making your functions behave in a standardized, consistent fashion.