How to Import a Module

Modules are packages of Windows PowerShell commands, such as cmdlets and functions, and items, such as providers, variables, aliases and drives. If you have downloaded, installed, or received a module, use the procedure that is described in this topic to import or add it to your Windows PowerShell session.

Before Importing: Install the Module

If you receive a module as a folder with files in it, you need to install it on your computer before you can import it into Windows PowerShell. Typically, installing is just copying the module to a particular location on a drive that your computer can access.

Most modules are installed for you. Windows PowerShell comes with several pre-installed modules. In Windows Server 2008 R2, the Add Features Wizard in Server Manager automatically installs the feature modules that you select. Many other modules come in an installer or setup program that installs the module.

For information about installing modules, see about_Modules.

How to Import a Module

To use the commands in a module, import the module into a Windows PowerShell session. To import modules from a default module location into the current session, use the following command format.

import-module <module-name>

For example, the following command imports the BitsTransfer module into the current session.

import-module BitsTransfer

To import a module that is not in a default module location, use the fully qualified path to the module folder in the command. For example, to add the TestCmdlets module in the C:\ps-test directory to your session, type:

import-module c:\ps-test\TestCmdlets

For more information about adding modules to your session, see Import-Module.

See Also