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