Template/PowerShell/Modules/Template_Cmdlets/ModuleName.psm1
# References: # 1. Below are the list of predefined vars that can be used: # - $PSScriptRoot [System defined] The folder path for current scipt file, NOT the caller script to call this function # Register all "*-*.ps1" script directly in the module folder (not including any sub folder) with an alias "*-*" Get-ChildItem -Path $PSScriptRoot -Filter "*-*.ps1" | % { $fileName = $_.Name.Trim() $cmdletName = $fileName.Substring(0, $fileName.Length - 4) $cmdletScript = $_.FullName Set-Alias -Name $cmdletName -Value $cmdletScript Export-ModuleMember -Alias $cmdletName Write-ColorHost "Import alias <Green>$cmdletName</Green> for $cmdletScript" -Type Verbose } |