Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Get-Module

Get-Module - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Get-Module

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

Syntax


Description
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.