Contact Info

Crumbtrail

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

Get-Module - Powershell 3.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
Get-Module [[-Name] <String[]>] [-All] [<CommonParameters>]
Get-Module [[-Name] <String[]>] [-All] [-Refresh] -ListAvailable [<CommonParameters>]
Get-Module [[-Name] <String[]>] [-CimNamespace <String>] [-CimResourceUri <Uri>] [-ListAvailable] [-Refresh] -CimSessio
n <CimSession> [<CommonParameters>]
Get-Module [[-Name] <String[]>] [-ListAvailable] [-Refresh] -PSSession <PSSession> [<CommonParameters>]





Description
The Get-Module cmdlet gets the Windows PowerShell modules that have been imported, or that can be imported, into a Wind
ows PowerShell session. The module object that Get-Module returns contains valuable information about the module. You c
an 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 modu
les, use the ListAvailable parameter.


Get-Module gets modules, but it does not import them. Beginning in Windows PowerShell 3.0, modules are automatically im
ported when you use a command in the module, but a Get-Module command does not trigger an automatic import. You can als
o 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-PSSessio
n cmdlet. When you use commands in modules imported from another session, the commands run implicitly in the remote ses
sion, 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 Informatio
n 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 enter
prises 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 PSSes
sion 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 ru
n 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 comp
uters that are not running a Windows operating system, and Windows computers that have Windows PowerShell, but do not h
ave 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.