When I enter in PowerShell:
Remove-Alias -Name someAlias
This error shows:
Remove-Alias : The term 'Remove-Alias' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Remove-Alias -Name someAlias
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Remove-Alias:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Note: someAlias is already in my alias list, I checked this.
To change or delete a read-only alias, use the Force parameter. The Set-Alias cmdlet creates an alias in the current PowerShell session. The Name parameter specifies the alias's name, loc . The Value parameter specifies the Get-Location cmdlet that the alias runs.
To create an alias for a command, create a function that includes the command, and then create an alias to the function. To save the aliases from a session and use them in a different session, add the Set-Alias * command to your Windows PowerShell profile.
The default value of $ErrorActionPreference is Continue. When that is the setting, the appearance when running ForLoop. ps1 is the same as that shown in Figure 17-1.
Powershell 5.1 docu of New-Alias
:
Notes To create a new alias, use Set-Alias or New-Alias. To change an alias, use Set-Alias. To delete an alias, use Remove-Item.
So under Powershell 5.x you've to use Remove-Item
. In stated in above comment Remove-Alias
is only supported in PowerShell 6.
Check this stackoverflow answer how an alias is removed via Remove-Item
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With