Gather information about PowerShell Modules
- Gather information about PowerShell Modules including information from PowerShellGet.
The below requirements are needed on the host that executes this module.
PowerShellGet
module
.. seealso:: :ref:`community.windows.win_psrepository_info_module` The official documentation on the **community.windows.win_psrepository_info** module. :ref:`community.windows.win_psscript_info_module` The official documentation on the **community.windows.win_psscript_info** module.
- name: Get info about all modules on the system
community.windows.win_psmodule_info:
- name: Get info about the ScheduledTasks module
community.windows.win_psmodule_info:
name: ScheduledTasks
- name: Get info about networking modules
community.windows.win_psmodule_info:
name: Net*
- name: Get info about all modules installed from the PSGallery repository
community.windows.win_psmodule_info:
repository: PSGallery
register: gallery_modules
- name: Update all modules retrieved from above example
community.windows.win_psmodule:
name: "{{ item }}"
state: latest
loop: "{{ gallery_modules.modules | map(attribute=name) }}"
- name: Get info about all modules on the system
community.windows.win_psmodule_info:
register: all_modules
- name: Find modules installed from a repository that isn't registered now
set_fact:
missing_repository_modules: "{{
all_modules
| json_query('modules[?repository!=null && repository==repository_source_location].{name: name, version: version, repository: repository}')
| list
}}"
- debug:
var: missing_repository_modules
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | ||
---|---|---|---|---|
modules
list
/ elements=dictionary
|
always |
A list of modules (or an empty list is there are none).
|
||
access_mode
string
|
The module's access mode. See https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduleaccessmode
Sample:
ReadWrite
|
|||
author
string
|
The author of the module.
Sample:
Warren Frame
|
|||
clr_version
string
|
The CLR version of the module.
Sample:
4.0
|
|||
company_name
string
|
The company name of the module.
Sample:
Microsoft Corporation
|
|||
compatible_ps_editions
list
/ elements=string
|
The PS Editions the module is compatible with.
Sample:
['Desktop']
|
|||
copyright
string
|
The copyright of the module.
Sample:
(c) 2016 Warren F. All rights reserved.
|
|||
dependencies
list
/ elements=string
|
The modules required by this module.
|
|||
description
string
|
The description of the module.
Sample:
Provides cmdlets to work with local users and local groups
|
|||
dot_net_framework_version
string
|
The .Net Framework version of the module.
Sample:
4.6.1
|
|||
exported_aliases
list
/ elements=string
|
The aliases exported from the module.
Sample:
['glu', 'slu']
|
|||
exported_cmdlets
list
/ elements=string
|
The cmdlets exported from the module.
Sample:
['Get-Certificate', 'Get-PfxData']
|
|||
exported_commands
list
/ elements=string
|
All of the commands exported from the module. Includes functions, cmdlets, and aliases.
Sample:
['glu', 'Get-LocalUser']
|
|||
exported_dsc_resources
list
/ elements=string
|
The DSC resources exported from the module.
Sample:
['xWebAppPool', 'xWebSite']
|
|||
exported_format_files
list
/ elements=path
|
The format files exported from the module.
Sample:
['C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsCmdlets.Format.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsConfig.Format.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsClientPSProvider.Format.ps1xml']
|
|||
exported_functions
list
/ elements=string
|
The functions exported from the module.
Sample:
['New-VirtualDisk', 'New-Volume']
|
|||
exported_type_files
list
/ elements=path
|
The type files exported from the module.
Sample:
['C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsCmdlets.Types.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsConfig.Types.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsClientPSProvider.Types.ps1xml']
|
|||
exported_variables
list
/ elements=string
|
The variables exported from the module.
Sample:
['GitPromptScriptBlock']
|
|||
exported_workflows
list
/ elements=string
|
The workflows exported from the module.
|
|||
file_list
list
/ elements=path
|
The files included in the module.
Sample:
['C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSModule.psm1', 'C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSGet.Format.ps1xml', 'C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSGet.Resource.psd1']
|
|||
guid
string
|
The GUID of the module.
Sample:
74c9fd30-734b-4c89-a8ae-7727ad21d1d5
|
|||
help_info_uri
string
|
The help info address of the module.
Sample:
|
|||
icon_uri
string
|
The address of the icon of the module.
Sample:
|
|||
installed_date
string
|
The date the module was installed.
Sample:
2018-02-14T17:55:34.9620740-05:00
|
|||
installed_location
string
|
The path where the module is installed.
This should have the same value as
module_base but only has a value when the module was installed via PowerShellGet.Sample:
C:\Program Files\WindowsPowerShell\Modules\posh-git\0.7.1
|
|||
license_uri
string
|
The address of the license for the module.
Sample:
|
|||
log_pipeline_execution_details
boolean
|
Determines whether pipeline execution detail events should be logged.
|
|||
module_base
string
|
The path that contains the module's files.
Sample:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI
|
|||
module_list
list
/ elements=dictionary
|
A list of modules packaged with this module.
This value is not often returned and the modules are not automatically processed.
|
|||
guid
string
|
The GUID of the module.
Sample:
82fdb72c-ecc5-4dfd-b9d5-83cf6eb9067f
|
|||
maximum_version
string
|
The maximum version of the module.
Sample:
2.9
|
|||
name
string
|
The name of the module.
This may also be a path to the module file.
Sample:
.\WindowsUpdateLog.psm1
|
|||
required_version
string
|
The exact version of the module required.
Sample:
3.1.4
|
|||
version
string
|
The minimum version of the module.
Sample:
2.0
|
|||
module_type
string
|
The module's type. See https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduletype
Sample:
Script
|
|||
name
string
|
The name of the module.
Sample:
PSReadLine
|
|||
nested_modules
list
/ elements=dictionary
|
A list of modules nested with and loaded into the scope of this module.
This list contains full module objects, so each item can have all of the properties listed here, including
nested_modules . |
|||
package_management_provider
string
|
If the module was installed from PowerShellGet, this is the package management provider used.
Sample:
NuGet
|
|||
path
string
|
The path to the module.
Sample:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI\PKI.psd1
|
|||
power_shell_host_name
string
|
The name of the PowerShell host that the module requires.
Sample:
Windows PowerShell ISE Host
|
|||
power_shell_host_version
string
|
The version of the PowerShell host that the module requires.
Sample:
1.1
|
|||
power_shell_version
string
|
The minimum version of PowerShell that the module requires.
Sample:
5.1
|
|||
prefix
string
|
The default prefix applied to
Verb-Noun commands exported from the module, resulting in Verb-PrefixNoun names. |
|||
private_data
dictionary
|
Arbitrary private data used by the module. This is typically defined in the module manifest.
This module limits the depth of the data returned for module types other than
Script and Manifest .The
PSData is commonly supplied and provides metadata for PowerShellGet but those fields are surfaced in top-level properties as well.Sample:
{'PSData': {'LicenseUri': 'https://example.com/module/LICENSE', 'ProjectUri': 'https://example.com/module/', 'ReleaseNotes': 'v2 - Fixed some bugs\nv1 - First release\n', 'Tags': ['networking', 'serialization']}}
|
|||
procoessor_architecture
string
|
The module's processor architecture. See https://docs.microsoft.com/en-us/dotnet/api/system.reflection.processorarchitecture
Sample:
Amd64
|
|||
project_uri
string
|
The address of the module's project.
Sample:
|
|||
published_date
string
|
The date the module was published.
Sample:
2017-03-15T04:18:09.0000000
|
|||
release_notes
string
|
The module's release notes. This is a free text field and no specific format should be assumed.
Sample:
## 1.4.6
- Update `HelpInfoUri` to point to the latest content
## 1.4.5
- Bug fix for deadlock when getting parameters in an event
## 1.4.4
- Bug fix when installing modules from private feeds
|
|||
repository
string
|
The PSRepository where the module was installed from.
This value is not historical. It depends on the PSRepositories that are registered now for the current user.
The
repository_source_location must match the current source location of a registered repository to get a repository name.If there is no match, then this value will match
repository_source_location .Sample:
PSGallery
|
|||
repository_source_location
string
|
The source location of the repository where the module was installed from.
Sample:
|
|||
required_assemblies
string
|
A list of assemblies that the module requires.
The values may be a simple name or a full path.
Sample:
['Microsoft.Management.Infrastructure.CimCmdlets.dll', 'Microsoft.Management.Infrastructure.Dll']
|
|||
required_modules
list
/ elements=dictionary
|
A list of modules required by this module.
This list contains full module objects, so each item can have all of the properties listed here, including
required_modules .These module objects may not contain full information however, so you may see different results than if you had directly queried the module.
|
|||
root_module
string
|
The root module as defined in the manifest.
This may be a module name, filename, or full path.
Sample:
WindowsErrorReporting.psm1
|
|||
scripts
list
|
A list of scripts (
.ps1 files) that run in the caller's session state when the module is imported.This value comes from the
ScriptsToProcess field in the module's manifest.Sample:
['PrepareEnvironment.ps1', 'InitializeData.ps1']
|
|||
tags
list
/ elements=string
|
The tags defined in the module's
PSData metadata.Sample:
['networking', 'serialization', 'git', 'dsc']
|
|||
updated_date
string
|
The date the module was last updated.
Sample:
2019-12-31T09:20:02.0000000
|
|||
version
string
|
The module version.
Sample:
1.2.3
|
- Brian Scholer (@briantist)