PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Get-Module', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Gets the modules that have been imported or that can be imported into the current session.


Get-Module [[-Name] [<String[]>]] [-All] [-FullyQualifiedName [<ModuleSpecification[]>]] [<CommonParameters>]
Get-Module [[-Name] [<String[]>]] [-All] [-FullyQualifiedName [<ModuleSpecification[]>]] [-Refresh] -ListAvailable [<CommonParameters>]
Get-Module [[-Name] [<String[]>]] [-CimNamespace [<String>]] [-CimResourceUri [<Uri>]] [-ListAvailable] [-Refresh] -CimSession <CimSession> [<CommonParameters>]
Get-Module [[-Name] [<String[]>]] [-FullyQualifiedName [<ModuleSpecification[]>]] [-ListAvailable] [-Refresh] -PSSession <PSSession> [<CommonParameters>]

Search powershellhelp.space


The Get-Module cmdlet gets the Windows PowerShell modules that have been imported, or that can be imported, into a Windows PowerShell session. The module object that
Get-Module returns contains valuable information about the module. You can also pipe the module objects to other cmdlets, such as the Import-Module and Remove-Module cmdlets.

Without parameters, Get-Module gets modules that have been imported into the current session. To get all installed modules, use the ListAvailable parameter.

Get-Module gets modules, but it does not import them. Beginning in Windows PowerShell 3.0, modules are automatically imported when you use a command in the module, but a
Get-Module command does not trigger an automatic import. You can also import the modules into your session by using the Import-Module cmdlet.

Beginning in Windows PowerShell 3.0, you can get (and then, import) modules from remote sessions into the local session. This strategy uses the Implicit Remoting feature of
Windows PowerShell and is equivalent to using the Import-PSSession cmdlet. When you use commands in modules imported from another session, the commands run implicitly in the
remote session, allowing you to manage the remote computer from the local session.

Also, beginning in Windows PowerShell 3.0, you can use Get-Module and Import-Module to get and import Common Information Model (CIM) modules, in which the cmdlets are
defined in Cmdlet Definition XML (CDXML) files. This feature allows you to use cmdlets that are implemented in non-managed code assemblies, such as those written in C++.

With these new features, the Get-Module and Import-Module cmdlets become primary tools for managing heterogeneous enterprises that include Windows computers and computers
that are running other operating systems.

To manage remote Windows computers that have Windows PowerShell and Windows PowerShell remoting enabled, create a PSSession on the remote computer and then use the PSSession
parameter of Get-Module to get the Windows PowerShell modules in the PSSession. When you import the modules, and then use the imported commands in the current session, the
commands run implicitly in the PSSession on the remote computer. You can use this strategy to manage the remote computer.

You can use a similar strategy to manage computers that do not have Windows PowerShell remoting enabled, including computers that are not running a Windows operating system,
and Windows computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled.

Begin by creating a "CIM session" on the remote computer; a connection to Windows Management Instrumentation (WMI) on the remote computer. Then use the CIMSession parameter
of Get-Module to get CIM modules from the CIM session. When you import a CIM module (by using the Import-Module cmdlet) and then run the imported commands, the commands run
implicitly on the remote computer. You can use this WMI and CIM strategy to manage the remote computer.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=289587




-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-Module

This command gets modules that have been imported into the current session.

-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-Module -ListAvailable

This command gets the modules that are installed on the computer and can be imported into the current session.

Get-Module looks for available modules in the path specified by the $env:PSModulePath environment variable. For more information about PSModulePath, see about_Modules and

-------------------------- EXAMPLE 3 --------------------------

PS C:\>Get-Module -ListAvailable -All

This command gets all of the exported files for all available modules.

-------------------------- EXAMPLE 4 --------------------------

PS C:\>Get-Module –FullyQualifiedName @{ModuleName="Microsoft.PowerShell.Management";ModuleVersion=""} | Format-Table -Property Name,Version
Name Version
---- -------

This command gets the Microsoft.PowerShell.Management module by specifying the module’s fully qualified name, with the FullyQualifiedName parameter. The command then pipes
the results into Format-Table, to format the results as a table with Name and Version as the column headings.

-------------------------- EXAMPLE 5 --------------------------

PS C:\>Get-Module | Get-Member -MemberType Property | Format-Table Name









































This command gets the properties of the PSModuleInfo object that Get-Module returns. There is one object for each module file.

You can use the properties to format and filter the module objects. For more information about the properties, see "PSModule Properties" in the MSDN (Microsoft Developer
Network) library at http://go.microsoft.com/fwlink/?LinkId=143624.

The output includes the new properties, such as Author and CompanyName, that were introduced in Windows PowerShell 3.0

-------------------------- EXAMPLE 6 --------------------------

PS C:\>Get-Module -ListAvailable -All | Format-Table -Property Name, Moduletype, Path -Groupby Name

Name: AppLocker

Name ModuleType Path

---- ---------- ----

AppLocker Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\AppLocker\AppLocker.psd1

Name: Appx

Name ModuleType Path

---- ---------- ----

Appx Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Appx\en-US\Appx.psd1

Appx Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Appx\Appx.psd1

Appx Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Appx\Appx.psm1

Name: BestPractices

Name ModuleType Path

---- ---------- ----

BestPractices Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\BestPractices\BestPractices.psd1

Name: BitsTransfer

Name ModuleType Path

---- ---------- ----

BitsTransfer Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1

This command gets all module files (imported and available) and groups them by module name. This lets you see the module files that each script is exporting.

-------------------------- EXAMPLE 7 --------------------------

The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the $m variable.
PS C:\>$m = Get-Module -list -Name BitsTransfer

The second command uses the Get-Content cmdlet to get the content of the manifest file in the specified path. It uses dot notation to get the path to the manifest file,
which is stored in the Path property of the object.The output shows the contents of the module manifest.
PS C:\>Get-Content $m.Path

Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
Description="Windows Powershell File Transfer Module"
RequiredAssemblies=Join-Path $psScriptRoot "Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll"

These commands display the contents of the module manifest for the Windows PowerShell BitsTransfer module.

Modules are not required to have manifest files and, when they do have a manifest file, the manifest file is required only to include a version number. However, manifest
files often provide useful information about a module, its requirements, and its contents.

-------------------------- EXAMPLE 8 --------------------------

PS C:\>dir (Get-Module -ListAvailable FileTransfer).ModuleBase
Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 12/16/2008 12:36 PM en-US
-a--- 11/19/2008 11:30 PM 16184 FileTransfer.Format.ps1xml
-a--- 11/20/2008 11:30 PM 1044 FileTransfer.psd1
-a--- 12/16/2008 12:20 AM 108544 Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll

This command lists the files in the module's directory. This is another way to determine what is in a module before you import it. Some modules might have help files or
ReadMe files that describe the module.

-------------------------- EXAMPLE 9 --------------------------

PS C:\>$s = New-PSSession -ComputerName Server01

PS C:\>Get-Module -PSSession $s -ListAvailable

These commands get the modules that are installed on the Server01 computer.

The first command uses the New-PSSession cmdlet to create a PSSession on the Server01 computer. The command saves the PSSession in the $s variable.

The second command uses the PSSession and ListAvailable parameters of Get-Module to get the modules in the PSSession in the $s variable.

If you pipe modules from other sessions to the Import-Module cmdlet, Import-Module imports the module into the current session by using the implicit remoting feature. This
is equivalent to using the Import-PSSession cmdlet. You can use the cmdlets from the module in the current session, but commands that use these cmdlets actually run the
remote session. For more information, see Import-Module and Import-PSSession.

-------------------------- EXAMPLE 10 --------------------------

The first command uses the New-CimSession cmdlet to create a session on the RSDGF03 remote computer. The session connects to WMI on the remote computer. The command saves
the CIM session in the $cs variable.
PS C:\>$cs = New-CimSession -ComputerName RSDGF03

The second command uses in the CIM session in the $cs variable to run a Get-Module command on the RSDGF03 computer. The command uses the Name parameter to specify the
Storage module.The command uses a pipeline operator (|) to send the Storage module to the Import-Module cmdlet, which imports it into the local session.
PS C:\>Get-Module -CimSession $cs -Name Storage | Import-Module

The third command runs the Get-Command cmdlet on the Get-Disk command in the Storage module.When you import a CIM module into the local session, Windows PowerShell converts
the CDXML files that represent in the CIM module into Windows PowerShell scripts, which appear as functions in the local session.
PS C:\>Get-Command Get-Disk
CommandType Name ModuleName

----------- ---- ----------

Function Get-Disk Storage

The fourth command runs the Get-Disk command. Although the command is typed in the local session, it runs implicitly on the remote computer from which it was imported.The
command gets objects from the remote computer and returns them to the local session.
PS C:\>Get-Disk
Number Friendly Name OperationalStatus Total Size Partition Style

------ ------------- ----------------- ---------- ---------------

0 Virtual HD ATA Device Online 40 GB MBR

The commands in this example enable you to manage the storage systems of a remote computer that is not running a Windows operating system. In this example, because the
administrator of the computer has installed the Module Discovery WMI provider, the CIM commands can use the default values, which are designed for the provider.