PowerShell Logo Small

Get-Module



This is the built-in help made by Microsoft for the command 'Get-Module', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' 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.

SYNOPSIS

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

SYNTAX


Get-Module [-All] [-ListAvailable] [-Name <string[]>] [<CommonParameters>]
Get-Module [[-Name] <string[]>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Module cmdlet gets the modules that have been imported, or that can be imported, into the session.

Get-Module only gets modules; it does not import them. To import the modules into your session, use Import-Module.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=141552
Import-Module
New-Module
Remove-Module
about_Modules

REMARKS

<

Examples


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

C:\PS>get-module



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








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

C:\PS>get-module -listAvailable



Description
-----------
This command gets the modules that 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 PSModulePa
th, see about_Modules and about_Environment_Variables.








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

C:\PS>get-module -listAvailable -all



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








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

C:\PS>get-module | get-member -type property

TypeName: System.Management.Automation.PSModuleInfo

Name MemberType Definition
---- ---------- ----------
AccessMode Property System.Management.Automation.ModuleAcc
Description Property System.String Description {get;set;}
ExportedAliases Property System.Collections.Generic.Dictionary`
ExportedCmdlets Property System.Collections.Generic.Dictionary`
ExportedFunctions Property System.Collections.Generic.Dictionary`
ExportedVariables Property System.Collections.Generic.Dictionary`
Guid Property System.Guid Guid {get;}
ModuleBase Property System.String ModuleBase {get;}
ModuleType Property System.Management.Automation.ModuleTyp
Name Property System.String Name {get;}
NestedModules Property System.Collections.ObjectModel.ReadOnl
OnRemove Property System.Management.Automation.ScriptBlo
Path Property System.String Path {get;}
PrivateData Property System.Object PrivateData {get;set;}
SessionState Property System.Management.Automation.SessionSt
Version Property System.Version Version {get;}



Description
-----------
This command get 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 M
SDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143624.








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

C:\PS>get-module -listAvailable -all | format-table -property name, moduletype, path -groupby name -auto

Name: MyTestCmdlets

Name ModuleType Path
---- ---------- ----
MyTestCmdlets Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\TestCmdlets\TestCmdlets.dll


Name: PSDiagnostics

Name ModuleType Path
---- ---------- ----
PSDiagnostics Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psd1
PSDiagnostics Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psm1


Name: FileTransfer

Name ModuleType Path
---- ---------- ----
FileTransfer Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1



Description
-----------
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 i
s exporting.








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

C:\PS>$m = get-module -list -name FileTransfer | where {$_.moduletype -eq "Manifest"}

C:\PS> get-content $m.path

@{
GUID="{8FA5064B-8479-4c5c-86EA-0D311FE48875}"
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
ModuleVersion="1.0.0.0"
Description="Windows Powershell File Transfer Module"
PowerShellVersion="2.0"
CLRVersion="2.0"
NestedModules="Microsoft.BackgroundIntelligentTransfer.Management"
FormatsToProcess="FileTransfer.Format.ps1xml"
RequiredAssemblies=Join-Path $psScriptRoot "Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll"
}



Description
-----------
These commands display the contents of the module manifest for the Windows PowerShell File Transfer module.

The first command gets the PSModuleInfo object that represent the module manifest for the File Transfer module. It saves the object in the $m var
iable.

The second command uses dot notation to get the path to the manifest file, which is stored in the Path property of the object. Then, it uses the
Get-Content cmdlet to get the content of the manifest file in the specified path.

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








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

C:\PS>get-module -listAvailable -name FileTransfer | format-list -property *

Name : FileTransfer
Path : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1
Description : Powershell File Transfer Module
Guid : 8fa5064b-8479-4c5c-86ea-0d311fe48875
ModuleBase : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer
PrivateData :
Version : 1.0.0.0
ModuleType : Manifest
AccessMode : ReadWrite
ExportedFunctions : {}
ExportedCmdlets : {}
NestedModules : {}
ExportedVariables : {}
ExportedAliases : {}
SessionState : System.Management.Automation.SessionState
OnRemove :



Description
-----------
This command displays all of the properties of the FileTransfer module in a list.

Because the module has not yet been imported into the session, the Exported* properties and the NestedModules property are not yet populated. The
se properties are populated only after the elements have been exported and the nested modules have been instantiated.








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

C:\PS>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



Description
-----------
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 m
ight have help files or ReadMe files that describe the module.