PowerTip: Use New-Alias to make Cmdlets easier to remember

Doctor Scripto

Dr Scripto

Summary: Using New-Alias to create easier to remember shortcuts to Cmdlets in PowerShell

A picture containing scissors  Description automatically generated

Hey, Doctor Scripto. I know I can use Install-Module to download a DSC Resource, but is there some way to build a Cmdlet that does the Exact same job but call it Install-DSCResource? I would find that easier to remember when getting them (DSCResources).

We can’t create a new Cmdlet, but we can create an Alias. It will respond to all the same parameters as the original. To make an Alias of Install-Module that says Install-DSCResource just execute the following line.

New-Alias -Name Install-DSCResource -value Install-Module -description ‘Alias for Install-Module’

PowerShell, Doctor Scripto, PowerTip, Sean Kearney

 

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment