public/Export/Export-GroupISETheme.ps1

Function Export-GroupISETheme {
    <#
    .SYNOPSIS
        Exports all PowerShell ISE themes from the registry to individual theme files.
 
    .DESCRIPTION
        The Export-GroupISETheme function retrieves all stored ISE themes from the registry and
        exports them to separate theme files in the specified directory using Export-ISEThemeFile.
 
    .PARAMETER ExportDirectory
        The destination path where theme files will be saved. The path must exist or be creatable
        by the user.
 
    .EXAMPLE
        Export-GroupISETheme -ExportDirectory 'C:\MyThemes'
 
        Exports all themes stored in the registry to the specified folder.
 
    .NOTES
        Author: Jeff Pollock
        GitHub: https://github.com/phriendx/ISEColorTheme.cmdlets
        Website: https://pxlabs.info
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]$ExportDirectory
    )

    $regPath = 'HKey_Current_User\Software\Microsoft\PowerShell\3\Hosts\PowerShellISE\ColorThemes'
    if (-not (Test-Path registry::"$regPath")) {
        Write-error "Registry path for ISE themes does not exist: $regPath"
        return
    }

    # Get all themes from the ISE
    $themes = (Get-Item -Path "Registry::$regPath").Property 

    foreach ($theme in $themes) {
        Export-ISEThemeFile -Name $theme -Directory $ExportDirectory -ISETheme $theme 
    }

    Write-Host "All themes exported to: $ExportDirectory"
}