Reputation: 29209
I have several functions which are called by many scripts located on the same or different machines on the same network (Company LAN). Is it possible to save/host these functions in one script instead of copy/paste them to every scripts?
function CommonFunc1($p1, $p2) { .... }
function SharedFunc2($p1, $p2, $p3) { .... }
Upvotes: 0
Views: 195
Reputation: 1386
Create a module for the function to go in, and put that module on a computer that's reachable by all others via drive mapping or network share etc. Then you can import the module from that machine.
Like this:
Import-Module \\machine-name\C$\path\to\module\module.psm1
Upvotes: 2