PSProfileMigrationAssistant.psm1
# Import-Module script logic for PSProfileMigrationAssistant # Get the module base path $ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Definition # Initialize Config $ConfigPath = Join-Path -Path $ModuleBase -ChildPath "Config\Config.ini" $Config = Read-Config -ConfigPath $ConfigPath # Function to load scripts from a folder function Import-ScriptsFromFolder { param ( [string]$FolderPath ) if (Test-Path $FolderPath) { Get-ChildItem -Path $FolderPath -Filter *.ps1 | ForEach-Object { . $_.FullName } } } # Load private functions $PrivateFolder = Join-Path -Path $ModuleBase -ChildPath "Private" Import-ScriptsFromFolder -FolderPath $PrivateFolder # Load public functions $PublicFolder = Join-Path -Path $ModuleBase -ChildPath "Public" Import-ScriptsFromFolder -FolderPath $PublicFolder # Export only public functions Export-ModuleMember -Function (Get-ChildItem -Path $PublicFolder -Filter *.ps1 | ForEach-Object { (Get-Content $_.FullName | Select-String -Pattern 'function\s+([a-zA-Z0-9\-_]+)' | ForEach-Object { $_.Matches.Groups[1].Value }) }) |