9

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.

Neo
  • 809
  • 8
  • 23

1 Answers1

13

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.

Moerwald
  • 9,219
  • 7
  • 35
  • 71
  • Well, that is if you don't have another add-on module\function that provides it. For Example --- Find-Command -Name Remove-Alias | Format-Table -AutoSize;Get-Command -Name Remove-Ali* | Format-Table -AutoSize – postanote Jun 24 '19 at 06:29