How to create a Powershell Alias for Set-Executionpolicy
As per the documentation:
You can assign an alias to a cmdlet, script, function, or executable file.
You cannot assign an alias to a command and its parameters. For example, you can assign an alias to the
Get-Eventlog
cmdlet, but you cannot assign an alias to theGet-Eventlog -LogName System
command.
This is presumably a way to avoid having to disambiguate a parameter that exists on an alias and which is passed when invoking the alias.
You therefore have two options:
-
Encapsulate your command in a function called
Enable-Rush
(note the PowerShell acceptable naming scheme, if you care); or -
Save the command as a file and create a alias to the file.
And to persist it, put it in a $PROFILE
.