Evergreen PowerShell Module

repository·main·Indexed 19 days ago

https://github.com/eucpilots/evergreen-module

A PowerShell module for programmatically retrieving the latest version numbers and download URLs for common enterprise Windows applications. It is designed for automation workflows such as image creation with Packer, application packaging for Microsoft Intune and Configuration Manager, and maintaining installer libraries. Key functions include Get-EvergreenApp, Find-EvergreenApp, and Save-EvergreenApp, which retrieve data exclusively from official vendor sources.

Tokens
9.5K
Snippets
38
Records
53
Agent score
60%

What's inside Evergreen

  1. What is Evergreen and how can it be used?

    main

    Evergreen is a PowerShell module designed to automate software deployments by providing the latest version numbers and download URLs for common Windows applications. It is particularly useful for:

    • Image Creation: Using tools like Hashicorp Packer to ensure images contain the latest application versions.
    • Endpoint Management: Keeping Microsoft Endpoint Manager (Configuration Manager or Microsoft Intune) up to date.
    • Installer Libraries: Regularly downloading and storing current application installers in a structured directory.
    • Package Manager Manifests: Constructing manifests for Winget, Chocolatey, or similar tools by retrieving version and URL data in a structured object format.
  2. What is Evergreen and when to use it

    main

    Evergreen is a PowerShell module designed to automate software deployments by providing the latest version numbers and download URLs for common Windows applications.

    It is particularly useful for:

    • Image Creation: Using tools like Hashicorp Packer to ensure images contain the latest software versions.
    • Endpoint Management: Keeping Microsoft Endpoint Manager (Configuration Manager or Microsoft Intune) up to date.
    • Installer Libraries: Regularly downloading and storing current application installers in a structured directory.
    • Package Manager Manifests: Generating manifests for tools like Winget or Chocolatey by retrieving the most recent version and URL objects.
  3. How Evergreen retrieves application data

    main

    Evergreen retrieves application version and download links exclusively from official sources (vendor websites, APIs, GitHub, SourceForge, etc.) and never from third parties. It uses four main strategies:

    1. Application Update APIs: Mimics the application's own update check (e.g., Microsoft Edge, Firefox).
    2. Repository APIs: Queries APIs from hosts like GitHub or SourceForge (e.g., Audacity, Notepad++).
    3. Web Page Queries: Targets JSON endpoints provided by vendor download pages to avoid fragile HTML scraping.
    4. Static URLs: Resolves evergreen/static URLs provided by vendors (e.g., Zoom, Microsoft FSLogix).

    Note: Evergreen does not perform HTML scraping. If a vendor requires HTML scraping to find versions, the project recommends using the Nevergreen project instead.

  4. Use Evergreen primary functions to manage applications

    main

    Evergreen provides three primary functions to interact with supported Windows applications:

    • Find-EvergreenApp: Lists all applications currently supported by the module.
    • Get-EvergreenApp: Returns detailed information about the latest release of a specific application, including its version number and download URL.
    • Save-EvergreenApp: A helper function that simplifies the process of downloading the application URLs retrieved via Get-EvergreenApp.
  5. Manually install Evergreen from the repository

    main

    If you cannot use the PowerShell Gallery, you can install the module manually:

    1. Download the main branch from the GitHub repository.
    2. Copy the contents of the Evergreen folder into one of your PowerShell Module Paths (e.g., %USERPROFILE%\Documents\WindowsPowerShell\Modules\).
    3. Open a PowerShell console as Administrator.
    4. Set the execution policy: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned (or Bypass).
    5. Unblock the downloaded files: Get-ChildItem -Path <path to module> -Recurse | Unblock-File.
    6. Verify installation with Get-Module -ListAvailable Evergreen.
    7. Load the module: Import-Module -Name Evergreen and run Update-Evergreen.
    # Verify installation
    Get-Module -ListAvailable Evergreen
    
    # Load and update
    Import-Module -Name Evergreen
    Update-Evergreen
  6. Install the Evergreen module via PowerShell Gallery

    main

    The recommended method to install Evergreen is via the PowerShell Gallery. This method supports Windows PowerShell 5.1 and PowerShell 7.0+.

    Install-Module -Name Evergreen
    Import-Module -Name Evergreen
    Update-Evergreen
  7. Download application installers with Save-EvergreenApp

    main

    The Save-EvergreenApp cmdlet downloads application installers or updaters from URIs provided by Get-EvergreenApp. It can automatically organize these files into a structured directory hierarchy based on application properties, or save them all into a single flat directory.

    Directory Structure Logic

    When using the -Path parameter, the cmdlet creates a directory structure based on the properties available on the input object. The hierarchy follows this order of properties (only existing properties are used):

    1. Product
    2. Track
    3. Channel
    4. Release
    5. Ring
    6. Version
    7. Language
    8. Architecture (processor)

    Usage Modes

    • Structured Mode (-Path): Creates the nested directory structure described above. This is useful for maintaining a clean, organized repository of different versions and architectures.
    • Flat Mode (-CustomPath): Saves all files directly into the specified directory without creating sub-directories. Note that if multiple files in the input have the same name, the cmdlet will download the first one and skip subsequent duplicates.
    # Structured download (creates sub-directories)
    Get-EvergreenApp -Name "AdobeAcrobat" | Save-EvergreenApp -Path "C:\Temp\Adobe"
    
    # Flat download (all files in one folder)
    Get-EvergreenApp -Name "AdobeAcrobat" | Save-EvergreenApp -CustomPath "C:\Temp\Adobe"
  8. Generate external help for platyPS

    main

    To generate external help files from the markdown documentation, use the New-ExternalHelp cmdlet. This process typically involves first updating the markdown help using Update-MarkdownHelp or Update-MarkdownHelpModule before running the external help generation command.

    # 1. Update the markdown help
    Update-MarkdownHelp -Path "/Users/aaron/projects/_EUCPilots/evergreen/docs/help/en-US"
    
    # 2. Generate the external help
    New-ExternalHelp -Path "help/en-US" -OutputPath "Evergreen/en-US" -Encoding ([System.Text.Encoding]::UTF8) -Force
  9. Update the Evergreen module

    main

    If you previously installed the module from the PowerShell Gallery, you can update to the latest version using Update-Module with the -Force parameter, followed by the Evergreen-specific update command.

    Update-Module -Name Evergreen -Force
    Update-Evergreen
  10. Find and retrieve applications via pipeline

    main

    If you are unsure of the exact application name, use Find-EvergreenApp to search for matches, then pipe the result to Get-EvergreenApp.

    Note: Get-EvergreenApp will only process the first application returned by the pipeline if multiple matches are found.

    # Find applications matching 'Teams' and query the first match
    Find-EvergreenApp -Name "Teams" | Get-EvergreenApp