community.windows.win_psmodule_info module – Gather information about PowerShell Modules
Note
This module is part of the community.windows collection (version 1.10.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.windows
.
To use it in a playbook, specify: community.windows.win_psmodule_info
.
Requirements
The below requirements are needed on the host that executes this module.
PowerShellGet
module
Parameters
Parameter |
Comments |
---|---|
The name of the module to retrieve. Supports any wildcard pattern supported by If omitted then all modules will returned. Default: “*” |
|
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 |
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 |
Description |
---|---|
A list of modules (or an empty list is there are none). Returned: always |
|
The module’s access mode. See https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduleaccessmode Returned: success Sample: “ReadWrite” |
|
The author of the module. Returned: success Sample: “Warren Frame” |
|
The CLR version of the module. Returned: success Sample: “4.0” |
|
The company name of the module. Returned: success Sample: “Microsoft Corporation” |
|
The PS Editions the module is compatible with. Returned: success Sample: [“Desktop”] |
|
The copyright of the module. Returned: success Sample: “(c) 2016 Warren F. All rights reserved.” |
|
The modules required by this module. Returned: success |
|
The description of the module. Returned: success Sample: “Provides cmdlets to work with local users and local groups” |
|
The .Net Framework version of the module. Returned: success Sample: “4.6.1” |
|
The aliases exported from the module. Returned: success Sample: [“glu”, “slu”] |
|
The cmdlets exported from the module. Returned: success Sample: [“Get-Certificate”, “Get-PfxData”] |
|
All of the commands exported from the module. Includes functions, cmdlets, and aliases. Returned: success Sample: [“glu”, “Get-LocalUser”] |
|
The DSC resources exported from the module. Returned: success Sample: [“xWebAppPool”, “xWebSite”] |
|
The format files exported from the module. Returned: success 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”] |
|
The functions exported from the module. Returned: success Sample: [“New-VirtualDisk”, “New-Volume”] |
|
The type files exported from the module. Returned: success 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”] |
|
The variables exported from the module. Returned: success Sample: [“GitPromptScriptBlock”] |
|
The workflows exported from the module. Returned: success |
|
The files included in the module. Returned: success 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”] |
|
The GUID of the module. Returned: success Sample: “74c9fd30-734b-4c89-a8ae-7727ad21d1d5” |
|
The help info address of the module. Returned: success |
|
The address of the icon of the module. Returned: success Sample: “https://raw.githubusercontent.com/powershell/psscriptanalyzer/master/logo.png” |
|
The date the module was installed. Returned: success Sample: “2018-02-14T17:55:34.9620740-05:00” |
|
The path where the module is installed. This should have the same value as Returned: success Sample: “C:\\Program Files\\WindowsPowerShell\\Modules\\posh-git\\0.7.1” |
|
The address of the license for the module. Returned: success Sample: “https://github.com/PowerShell/xPendingReboot/blob/master/LICENSE” |
|
Determines whether pipeline execution detail events should be logged. Returned: success |
|
The path that contains the module’s files. Returned: success Sample: “C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\PKI” |
|
A list of modules packaged with this module. This value is not often returned and the modules are not automatically processed. Returned: success |
|
The GUID of the module. Returned: success Sample: “82fdb72c-ecc5-4dfd-b9d5-83cf6eb9067f” |
|
The maximum version of the module. Returned: success Sample: “2.9” |
|
The name of the module. This may also be a path to the module file. Returned: success Sample: “.\\WindowsUpdateLog.psm1” |
|
The exact version of the module required. Returned: success Sample: “3.1.4” |
|
The minimum version of the module. Returned: success Sample: “2.0” |
|
The module’s type. See https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduletype Returned: success Sample: “Script” |
|
The name of the module. Returned: success Sample: “PSReadLine” |
|
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 Returned: success |
|
If the module was installed from PowerShellGet, this is the package management provider used. Returned: success Sample: “NuGet” |
|
The path to the module. Returned: success Sample: “C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\PKI\\PKI.psd1” |
|
The name of the PowerShell host that the module requires. Returned: success Sample: “Windows PowerShell ISE Host” |
|
The version of the PowerShell host that the module requires. Returned: success Sample: “1.1” |
|
The minimum version of PowerShell that the module requires. Returned: success Sample: “5.1” |
|
The default prefix applied to Returned: 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 The Returned: success 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”]}} |
|
The module’s processor architecture. See https://docs.microsoft.com/en-us/dotnet/api/system.reflection.processorarchitecture Returned: success Sample: “Amd64” |
|
The date the module was published. Returned: success Sample: “2017-03-15T04:18:09.0000000” |
|
The module’s release notes. This is a free text field and no specific format should be assumed. Returned: success Sample: “## 1.4.6\n- Update `HelpInfoUri` to point to the latest content\n\n## 1.4.5\n- Bug fix for deadlock when getting parameters in an event\n\n## 1.4.4\n- Bug fix when installing modules from private feeds\n” |
|
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 If there is no match, then this value will match Returned: success Sample: “PSGallery” |
|
The source location of the repository where the module was installed from. Returned: success Sample: “https://www.powershellgallery.com/api/v2” |
|
A list of assemblies that the module requires. The values may be a simple name or a full path. Returned: success Sample: [“Microsoft.Management.Infrastructure.CimCmdlets.dll”, “Microsoft.Management.Infrastructure.Dll”] |
|
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 These module objects may not contain full information however, so you may see different results than if you had directly queried the module. Returned: success |
|
The root module as defined in the manifest. This may be a module name, filename, or full path. Returned: success Sample: “WindowsErrorReporting.psm1” |
|
A list of scripts ( This value comes from the Returned: success Sample: [“PrepareEnvironment.ps1”, “InitializeData.ps1”] |
|
The tags defined in the module’s Returned: success Sample: [“networking”, “serialization”, “git”, “dsc”] |
|
The date the module was last updated. Returned: success Sample: “2019-12-31T09:20:02.0000000” |
|
The module version. Returned: success Sample: “1.2.3” |
Authors
Brian Scholer (@briantist)