community.windows.win_psmodule_info – Gather information about PowerShell Modules

Note

This plugin is part of the community.windows collection (version 1.3.0).

To install it use: ansible-galaxy collection install community.windows.

To use it in a playbook, specify: community.windows.win_psmodule_info.

Synopsis

  • Gather information about PowerShell Modules including information from PowerShellGet.

Requirements

The below requirements are needed on the host that executes this module.

  • PowerShellGet module

Parameters

Parameter Choices/Defaults Comments
name
string
Default:
"*"
The name of the module to retrieve.
Supports any wildcard pattern supported by Get-Module.
If omitted then all modules will returned.
repository
string
The name of the PSRepository the modules were installed from.
This acts as a filter against the modules that would be returned based on the name option.
Modules that were not installed from a repository will not be returned if this option is set.
Only modules installed from a registered repository will be returned.
If the repository was re-registered after module installation with a new SourceLocation, this will not match.

See Also

See also

community.windows.win_psrepository_info

The official documentation on the community.windows.win_psrepository_info module.

community.windows.win_psscript_info

The official documentation on the community.windows.win_psscript_info module.

Examples

- 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

Return Values

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
success
Sample:
ReadWrite
 
author
string
success
The author of the module.

Sample:
Warren Frame
 
clr_version
string
success
The CLR version of the module.

Sample:
4.0
 
company_name
string
success
The company name of the module.

Sample:
Microsoft Corporation
 
compatible_ps_editions
list / elements=string
success
The PS Editions the module is compatible with.

Sample:
['Desktop']
 
copyright
string
success
The copyright of the module.

Sample:
(c) 2016 Warren F. All rights reserved.
 
dependencies
list / elements=string
success
The modules required by this module.

 
description
string
success
The description of the module.

Sample:
Provides cmdlets to work with local users and local groups
 
dot_net_framework_version
string
success
The .Net Framework version of the module.

Sample:
4.6.1
 
exported_aliases
list / elements=string
success
The aliases exported from the module.

Sample:
['glu', 'slu']
 
exported_cmdlets
list / elements=string
success
The cmdlets exported from the module.

Sample:
['Get-Certificate', 'Get-PfxData']
 
exported_commands
list / elements=string
success
All of the commands exported from the module. Includes functions, cmdlets, and aliases.

Sample:
['glu', 'Get-LocalUser']
 
exported_dsc_resources
list / elements=string
success
The DSC resources exported from the module.

Sample:
['xWebAppPool', 'xWebSite']
 
exported_format_files
list / elements=path
success
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
success
The functions exported from the module.

Sample:
['New-VirtualDisk', 'New-Volume']
 
exported_type_files
list / elements=path
success
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
success
The variables exported from the module.

Sample:
['GitPromptScriptBlock']
 
exported_workflows
list / elements=string
success
The workflows exported from the module.

 
file_list
list / elements=path
success
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
success
The GUID of the module.

Sample:
74c9fd30-734b-4c89-a8ae-7727ad21d1d5
 
help_info_uri
string
success
The help info address of the module.

Sample:
https://go.microsoft.com/fwlink/?linkid=390823
 
icon_uri
string
success
The address of the icon of the module.

Sample:
https://raw.githubusercontent.com/powershell/psscriptanalyzer/master/logo.png
 
installed_date
string
success
The date the module was installed.

Sample:
2018-02-14T17:55:34.9620740-05:00
 
installed_location
string
success
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
success
The address of the license for the module.

Sample:
https://github.com/PowerShell/xPendingReboot/blob/master/LICENSE
 
log_pipeline_execution_details
boolean
success
Determines whether pipeline execution detail events should be logged.

 
module_base
string
success
The path that contains the module's files.

Sample:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI
 
module_list
list / elements=dictionary
success
A list of modules packaged with this module.
This value is not often returned and the modules are not automatically processed.

   
guid
string
success
The GUID of the module.

Sample:
82fdb72c-ecc5-4dfd-b9d5-83cf6eb9067f
   
maximum_version
string
success
The maximum version of the module.

Sample:
2.9
   
name
string
success
The name of the module.
This may also be a path to the module file.

Sample:
.\WindowsUpdateLog.psm1
   
required_version
string
success
The exact version of the module required.

Sample:
3.1.4
   
version
string
success
The minimum version of the module.

Sample:
2.0
 
module_type
string
success
Sample:
Script
 
name
string
success
The name of the module.

Sample:
PSReadLine
 
nested_modules
list / elements=dictionary
success
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
success
If the module was installed from PowerShellGet, this is the package management provider used.

Sample:
NuGet
 
path
string
success
The path to the module.

Sample:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI\PKI.psd1
 
power_shell_host_name
string
success
The name of the PowerShell host that the module requires.

Sample:
Windows PowerShell ISE Host
 
power_shell_host_version
string
success
The version of the PowerShell host that the module requires.

Sample:
1.1
 
power_shell_version
string
success
The minimum version of PowerShell that the module requires.

Sample:
5.1
 
prefix
string
success
The default prefix applied to Verb-Noun commands exported from the module, resulting in Verb-PrefixNoun names.

 
private_data
dictionary
success
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
success
Sample:
Amd64
 
project_uri
string
success
The address of the module's project.

Sample:
https://github.com/psake/psake
 
published_date
string
success
The date the module was published.

Sample:
2017-03-15T04:18:09.0000000
 
release_notes
string
success
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
success
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
success
The source location of the repository where the module was installed from.

Sample:
https://www.powershellgallery.com/api/v2
 
required_assemblies
string
success
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
success
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
success
The root module as defined in the manifest.
This may be a module name, filename, or full path.

Sample:
WindowsErrorReporting.psm1
 
scripts
list / elements=string
success
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
success
The tags defined in the module's PSData metadata.

Sample:
['networking', 'serialization', 'git', 'dsc']
 
updated_date
string
success
The date the module was last updated.

Sample:
2019-12-31T09:20:02.0000000
 
version
string
success
The module version.

Sample:
1.2.3


Authors

  • Brian Scholer (@briantist)