Function or Module, how to


I have done some powershell scripts to the server.

I would like make scripts to functions or modules so

Everyone who has access to the server, so they can call them

From powershell command line without going to scripts location or import anything.


Should I save them then %windir%\system32\WindowsPowerShell\v1.0\profile.ps1

Or somehow to save to them as some modules.

I think module is easy handle, so I can group Functions.

How I can make module automatically activated so it doesn’t

Need to be loaded?

Or how I should be doing this?

From PowerShell version 3.0 on wards, any modules under the $env:PSModulePath locations will be auto loaded. You can place the module under any folder which is specified in that environment variable. Modules folder under $env:HomePath\Documents\Windows\PowerShell is the one which is recommended.

The module auto load is handled using $PSModuleAutoLoadingPreference automatic variable, setting this to $false will disable auto loading feature.


Big thanks your advice!