Public/Get-MSPBackupMySQLEntry.ps1

Function Get-MSPBackupMySQLEntry {
    <#
        .SYNOPSIS
            List existing MySQL server entries.
        .DESCRIPTION
            List existing MySQL server entries. Produces a table with columns in this order:
            NAME Unique entry name
            USER Login username
            PASSWD Login password
            SRVPORT MySQL server port
 
            Entry name (first column) could further be used to modify or remove that specific entry.
        .INPUTS
            None
        .OUTPUTS
            None
        .EXAMPLE
            Get-MSPBackupMySQLEntry
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
    #>

    [CmdletBinding()]
    [OutputType('System.String')]
    Param()
    Begin {
        Write-Verbose ('{0}:: Function started' -f $MyInvocation.MyCommand)
        $stdOutTempFile = [System.IO.Path]::GetTempFileName()
        $stdErrTempFile = [System.IO.Path]::GetTempFileName()
    }
    Process {
        Write-Verbose ('{0}:: Getting status' -f $MyInvocation.MyCommand)
        $MySQLDBList = & $Script:CmdPath -machine-readable control.mysqldb.list -delimiter ';' -no-header
        If ($null -ne $MySQLDBList) {
            $MySQLDBList = $MySQLDBList.Split(";")
            [array]$Hash += $(New-CustomPSObject "Name", "User", "Password", "ServerPort" "$($MySQLDBList[0])", "$($MySQLDBList[1])", "$($MySQLDBList[2])", "$($MySQLDBList[3])")
        } Else {
            $Hash = $null
        }
    }
    End {
        Write-Verbose ('{0}:: Function ended' -f $MyInvocation.MyCommand)
        Return $Hash
    }
}