Public/Get-CredentialFromStore.ps1
function Get-CredentialFromStore { [Diagnostics.CodeAnalysis.SuppressMessageAttribute( "PSAvoidUsingPlainTextForPassword", "", Justification = "CredentialName only refers to an entryin CredentialStore" )] [CmdletBinding()] [OutputType([pscredential])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $CredentialName , [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $CredentialStore ) $Path = Join-Path -Path $CredentialStore -ChildPath ($CredentialName + '.clixml') Import-Clixml -Path $Path } |