Get-Config.ps1

 function Get-Config {
    <#
    .Synopsis
        Gets stored configurations
    .Description
        Gets stored DSC configurations.
    .Example
        Get-Config
    .Link
        Save-Config
    .Link
        Use-Config
    #>

    [OutputType([PSObject], [Management.Automation.ExternalScriptInfo])]
    param(
    # The name of the configuration
    [Parameter(Position=0, ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
    [string]$Name
    )

    process {
        #region Find Configuration Files
        $configRoots = Join-Path (Join-Path $env:ProgramData "Start-Automating") "cFg"        

        $Filter = if ($Name) {
            "$name.config.ps1"
        } else {
            "*.config.ps1"
        }
                
        $files = $configRoots | 
            Get-ChildItem -ErrorAction SilentlyContinue -Filter $Filter
        #endregion Find Configuration Files
        foreach ($_ in $files) {
            
            # Find corresponding note file, if it exists
            $notePath = $_.FullName -ireplace '\.config\.ps1', '.config.notes.txt'                        
            $notes = 
                if ([IO.File]::Exists($notePath)) {
                    [IO.File]::ReadAllText($notePath)
                } else {
                    ""
                }                       


            if ($Name) {
                # If a name was provided, we want to return the command itself
                $resolvedCommand = $ExecutionContext.SessionState.InvokeCommand.GetCommand($_.FullName, 'ExternalScript')
                # We need to have a couple of extra properties to help us later though. Specifically, the name and the notes
                Add-Member NoteProperty Name ($_.Name -ireplace '\.config\.ps1') -inputObject $resolvedCommand -Force
                Add-Member NoteProperty Notes $notes -inputObject $resolvedCommand -Force

                # This will tweak how the configuration will be displayed to the user
                $resolvedCommand.pstypenames.clear()
                $resolvedCommand.pstypenames.add('cFg.DSC.SavedConfiguration')
                $resolvedCommand
            } else {
                # If no name was provided, we want summary data
                $outputObject = New-Object PSObject -Property @{
                    Name = $_.Name -ireplace '\.config\.ps1', ''
                    Owner  = $_.GetAccessControl().Owner
                    Path = $_.FullName
                    Notes = $notes
                }                
                # Giving it a typename makes it easy to format
                $outputObject.pstypenames.add('cFg.DSC.SavedConfigurationMetadata')
                $outputObject
            }

            
        }            
    }
 }