Analyth.PowerShell.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Module: Analyth.PowerShell #Requires -RunAsAdministrator $moduleName = "Analyth.PowerShell" # Import functions $publicFunctions = Get-ChildItem -Path $PSScriptRoot\Functions\Public -Filter *.ps1 foreach ($function in $publicFunctions) { . $function.FullName } $privateFunctions = Get-ChildItem -Path $PSScriptRoot\Functions\Private -Filter *.ps1 foreach ($function in $privateFunctions) { . $function.FullName } # This command is automatically executed when the module is loaded to create aliases with prefix "ana" for all the functions Get-Command -Module $moduleName | Where-Object { ($_.CommandType -eq "function" -and $_.Name -ne "Test-IsAdmin") } | ForEach-Object { $name = $_.Name ; Set-Alias "ana-$name" $name } |