Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 2.0 » New-Module

New-Module - Powershell 2.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 »

New-Module

Short description
Creates a new dynamic module that exists only in memory.

Syntax


Description
The New-Module cmdlet creates a dynamic module from a script block. The members of the dynamic module, such as func
tions and variables, are immediately available in the session and remain available until you close the session.

Like static modules, by default, the cmdlets and functions in a dynamic module are exported and the variables and a
liases are not. However, you can use the Export-ModuleMember cmdlet and the parameters of New-Module to override th
e defaults.

Dynamic modules  exist only in memory, not on disk. Like all modules, the members of dynamic modules run in a priva
te module scope that is a child of the global scope. Get-Module cannot get a dynamic module, but Get-Command can ge
t the exported members.

To make a dynamic module available to Get-Module, pipe a New-Module command to Import-Module, or pipe the module ob
ject that New-Module returns to Import-Module. This action adds the dynamic module to the Get-Module list, but it d
oes not save the module to disk or make it persistent.