TestPowershellPackage.psm1
$allScripts = @( Get-ChildItem -Path $PSScriptRoot\Scripts\*.ps1 -ErrorAction SilentlyContinue ) foreach ($script in $allScripts) { try { . $script.Fullname Export-ModuleMember -Function $script.BaseName -Alias $script.BaseName } catch { Write-Error -Message "Failed to import script $($script.Fullname): $_.Exception.Message" return } } |