Adding Aliases to your Functions with an Attribute

Function Test-Something {
[Alias("ts")]
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(ValueFromPipeline)]
$What
)

Process {
        if ($pscmdlet.ShouldProcess($What)) {
            
        }
} # End Process

} # En

 

I picked this tip up on one of the videos from the PS Summit in Europe.  If I paste this into a PS session, I will get the alias automatically. #learnSomethingNewEveryDay

Comments are closed