The Get-Module command

The Microsoft Windows operating system, especially the most recent versions, comes with a wide variety of modules preinstalled. These, as well as any other modules that have been installed, can be viewed using the Get-Module command.

By default, Get-Module shows modules that have been imported (either automatically or using Import-Module); for example, if the command is run from PowerShell ISE, it will show that the ISE module has been loaded:

PS> Get-Module

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.0.0 ISE {Get-
IseSnippet...}

Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-
Computer...}

Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member...}

The ListAvailable parameter shows a complete list of modules:

Get-Module -ListAvailable 

Modules are listed here if they are found under any of the paths in the %PSMODULEPATH% environment variable. The variable contains the following paths:

PS> $env:PSModulePath -split ';'
C:UserswhoamiDocumentsWindowsPowerShellModules
C:WINDOWSsystem32WindowsPowerShellv1.0Modules
C:Program FilesWindowsPowerShellModules

Additional paths to search may be added to the %PSMODULEPATH% variable if required.

Modules may exist in more than one location. Get-Module (and Import-Module) will consider each path in order so that if a matching module is found, the search stops (even if a newer version exists in a different directory).

Merging environment variables:
The %PSModulePath% environment variable is made up of user-level and machine-level settings. The value held in $env:PSMODULEPATH is the result of merging the two values (values from user followed by values from the machine).

Get-Module can show each instance of a module regardless of the path using the All parameter:

Get-Module <ModuleName> -All -ListAvailable 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.186.46