Your functions can be made easier to use by including them in a script module instead of including them
in a script.
When you save your module in the correct location, Windows PowerShell can find your module automatically
loaded automatically and make your functions available as commands inside the shell.
You will no longer have to provide a path or file name to run your functions.
Instead, you type their names just as you would for any Windows PowerShell command.
A script module is any Windows PowerShell script that contains functions and is saved in the correct
location with the correct file name extension.
The module path environment variable contains a list of correct locations.
By default, it contains the following value.
C Backslash Users Backslash Username Backslash Documents Backslash Windows PowerShell backslash modules.
C Backslash Windows backslash system32 backslash windows PowerShell backslash v 1.0 backslash modules.
You can view the variable on your computer by running get content EMV Backslash module path note one
of the default module locations does not actually exist by default.
The location in your documents folder must be manually created before you can save modules there.
You should not save modules in the system32 path.
That location is reserved for modules created by Microsoft registered.
If you have a script that you want to save as a script module, you have to decide on a unique module
name.
For example, my tools is a possible module name.
Module names should contain only letters and numbers and no spaces or punctuation.
If you selected my tools as your module name, you would save the file as C backslash users.
Backslash Username Backslash Documents backslash windows PowerShell backslash modules backslash my tools
backslash my tools dot psm one.
Notice that the module must be saved with a dot PSM one file name extension and that the file must be
in a subfolder that has the module name.
This is a very common point of confusion.
For example, if the module name is my tools, the file name must be my tool's dot PSM one, and it
must be saved as backslash modules backslash my tools backslash my tools dot psm one so that the file
name and its containing folder name are the same note.
Use caution when you save script modules in the Windows PowerShell ISC.
If you just click documents in the save as dialog box, you are accessing the whole documents library.
You should expand the library node and make sure that you have selected the documents folder instead
of the public documents folder.