$ModuleRoot = $PSScriptRoot if([String]::IsNullOrWhiteSpace($ModuleRoot)){ throw "This compatibility loader must be dot-sourced from a file path. Use Import-Module './Merge-DSCConfigurationData.psd1' for module usage." } $PrivatePath = Join-Path -Path $ModuleRoot -ChildPath "Private" $PublicPath = Join-Path -Path $ModuleRoot -ChildPath "Public" $Private = @(Get-ChildItem -Path $PrivatePath -Filter "*.ps1" -File -ErrorAction Stop | Sort-Object -Property FullName) $Public = @(Get-ChildItem -Path $PublicPath -Filter "*.ps1" -File -ErrorAction Stop | Sort-Object -Property FullName) foreach($File in @($Private + $Public)){ . $File.FullName }