script/storedcredential/public/Show-StoredCredential.ps1

Function Show-StoredCredential {
    [OutputType([string[]])]
    Param()

    $directory = Get-StoredCredentialDirectory

    $domainFolders = Get-ChildItem $directory

    $credentials = @()
    foreach ($domainFolder in $domainFolders) {
        $credentialFiles = Get-ChildItem $domainFolder.FullName

        foreach ($credentialFile in $credentialFiles) {
            $domainName = $domainFolder.Name
            $credentialName = $credentialFile.Name.Replace(".xml", "")

            $credentials += "$domainName\$credentialName"
        }
    }

    return $credentials
}