On this page
community.windows.win_psscript_info – Gather information about installed PowerShell Scripts
Note
This plugin is part of the community.windows collection (version 1.7.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_psscript_info.
Synopsis
- Gather information about PowerShell Scripts installed via PowerShellGet.
 
Requirements
The below requirements are needed on the host that executes this module.
PowerShellGetmodule
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| name
        
        string
         | 
      Default: 
        "*"
         | 
      
        
        The name of the script.
        
       
        Supports any wildcard pattern supported by  
       Get-InstalledScript.
       
        If omitted then all scripts will returned.
         | 
     
| repository
        
        string
         | 
      
        
        The name of the PSRepository the scripts were installed from.
        
       
        This acts as a filter against the scripts that would be returned based on the name option.
        
       
        Only scripts installed from a registered repository will be returned.
        
       
        If the repository was re-registered after script 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_psmodule_info
 - 
     
The official documentation on the community.windows.win_psmodule_info module.
 
Examples
- name: Get info about all script on the system
  community.windows.win_psscript_info:
- name: Get info about the Test-RPC script
  community.windows.win_psscript_info:
    name: Test-RPC
- name: Get info about test scripts
  community.windows.win_psscript_info:
    name: Test*
- name: Get info about all scripts installed from the PSGallery repository
  community.windows.win_psscript_info:
    repository: PSGallery
  register: gallery_scripts
- name: Update all scripts retrieved from above example
  community.windows.win_psscript:
    name: "{{ item }}"
    state: latest
  loop: "{{ gallery_scripts.scripts | map(attribute=name) }}"
- name: Get info about all scripts on the system
  community.windows.win_psscript_info:
  register: all_scripts
- name: Find scripts installed from a repository that isn't registered now
  set_fact:
    missing_repository_scripts: "{{
      all_scripts
      | json_query('scripts[?repository!=null && repository==repository_source_location].{name: name, version: version, repository: repository}')
      | list
    }}"
- debug:
    var: missing_repository_scripts
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
| scripts
        
        list / elements=dictionary
         | 
      always | 
        
        A list of installed scripts (or an empty list is there are none).
          | 
     |
| additional_metadata
        
        dictionary
         | 
      success | 
        
        Additional metadata included with the script or during publishing of the script.
        
       
        Many of the fields here are surfaced at the top level with some standardization. The values here may differ slightly as a result.
        
       
        The field names here vary widely in case, and are not normalized or converted to snake_case.
          | 
     |
| author
        
        string
         | 
      success | 
        
        The author of the script.
         Sample:
        
       
        Ryan Ries
         | 
     |
| company_name
        
        string
         | 
      success | 
        
        The company name of the script.
         Sample:
        
       
        Microsoft Corporation
         | 
     |
| copyright
        
        string
         | 
      success | 
        
        The copyright of the script.
         Sample:
        
       
        Jordan Borean 2017
         | 
     |
| dependencies
        
        list / elements=string
         | 
      success | 
        
        The script's dependencies.
          | 
     |
| description
        
        string
         | 
      success | 
        
        The description of the script.
         Sample:
        
       
        This scripts tests network connectivity.
         | 
     |
| icon_uri
        
        string
         | 
      success | 
        
        The address of the icon of the script.
         Sample:
        
       
        https://raw.githubusercontent.com/scripter/script/main/logo.png
         | 
     |
| installed_date
        
        string
         | 
      success | 
        
        The date the script was installed.
         Sample:
        
       
        2018-02-14T17:55:34.9620740-05:00
         | 
     |
| installed_location
        
        string
         | 
      success | 
        
        The path where the script is installed.
         Sample:
        
       
        C:\Program Files\WindowsPowerShell\Scripts
         | 
     |
| license_uri
        
        string
         | 
      success | 
        
        The address of the license for the script.
         Sample:
        
       
        https://raw.githubusercontent.com/scripter/script/main/LICENSE
         | 
     |
| name
        
        string
         | 
      success | 
        
        The name of the script.
         Sample:
        
       
        Test-RPC
         | 
     |
| package_management_provider
        
        string
         | 
      success | 
        
        This is the PowerShellGet package management provider used to install the script.
         Sample:
        
       
        NuGet
         | 
     |
| power_shell_get_format_version
        
        string
         | 
      success | 
        
        The version of the PowerShellGet specification format.
         Sample:
        
       
        2.0
         | 
     |
| project_uri
        
        string
         | 
      success | 
        
        The address of the script's project.
         Sample:
        
       
        https://github.com/scripter/script
         | 
     |
| published_date
        
        string
         | 
      success | 
        
        The date the script was published.
         Sample:
        
       
        2017-03-15T04:18:09.0000000
         | 
     |
| release_notes
        
        string
         | 
      success | 
        
        The script's release notes. This is a free text field and no specific format should be assumed.
         Sample:
        
       
        ## 1.5.5 - Add optional param for detailed info ## 1.4.7 - Bug fix for deadlock when getting parameters in an event ## 1.1.4 - Bug fix when installing package from private feeds
         | 
     |
| repository
        
        string
         | 
      success | 
        
        The PSRepository where the script 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 script was installed from.
         Sample:
        
       
        https://www.powershellgallery.com/api/v2
         | 
     |
| tags
        
        list / elements=string
         | 
      success | 
        
        The tags defined in the script's   AdditionalMetadata.
       Sample:
        
       
        ['networking', 'serialization', 'git', 'dsc']
         | 
     |
| updated_date
        
        string
         | 
      success | 
        
        The date the script was last updated.
         Sample:
        
       
        2019-12-31T09:20:02.0000000
         | 
     |
| version
        
        string
         | 
      success | 
        
        The script version.
         Sample:
        
       
        1.2.3
         | 
     |
Authors
- Brian Scholer (@briantist)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/community/windows/win_psscript_info_module.html