Helpers/Profile/Import-ProfileEnvironmentCredential.ps1
function Import-ProfileEnvironmentCredential { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateScript({ Test-Path -Path $_ })] [System.String] $Path ) foreach ($File in (Get-ChildItem -Path $Path -Filter '*.credential.xml')) { $Credential = Import-Clixml -Path $File.FullName $CredentialName = 'CRED_' + $File.Name.Replace('.credential.xml', '') New-Variable -Name $CredentialName -Value $Credential -Scope Global } } |