powershell can't use remove-alias

Viewed 7949

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.

1 Answers

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.

Related