Use-Credential.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<#
.Synopsis
    Uses a saved credential.
 
.Description
    Uses a saved credential.
 
.Parameter Name
    The name of the credential.
#>

function Use-Credential {
    param([Parameter(ValueFromPipeline)][string]$Name = "Default")

    if($script:CredList.keys -contains $Name) { $script:CredList[$Name] }
    else { Write-Error "The credential '$name' does not exist." }
}

Export-ModuleMember -Function "Use-Credential"