Skip to content

Commit

Permalink
Enabling PSA Module Profile (Fixes #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating authored and StartAutomating committed Sep 15, 2023
1 parent 8a5614c commit c5e39d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions PSA.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ $commandsPath = Join-Path $psScriptRoot Commands
. $file.FullName
}

$exportedVariables = @("$($MyInvocation.MyCommand.ScriptBlock.Module.Name)")

$psa = $MyInvocation.MyCommand.ScriptBlock.Module

if ($profile) {
@($profile.psobject.properties |
Where-Object MemberType -EQ NoteProperty |
Select-Object -ExpandProperty Value) -as [io.fileinfo[]] |
Split-Path |
Select-Object -Unique |
Where-Object { $_ } |
Join-Path -ChildPath "$($MyInvocation.MyCommand.ScriptBlock.Module.Name).profile.ps1" |
Where-Object { $_ | Test-Path } |
. { process {
. "$_"
} }
}

Export-ModuleMember -Function * -Alias * -Variable $exportedVariables

0 comments on commit c5e39d1

Please sign in to comment.