$localPath = $script:MyInvocation.MyCommand.Path Get-ChildItem (Split-Path $localPath) -Filter '*.ps1' -Recurse | ForEach-Object { . $_.FullName } Get-ChildItem "$(Split-Path $localPath)" -Filter '*.ps1' -Recurse | ForEach-Object { Export-ModuleMember -Function $_.BaseName }