Problem:
You want to remove a Windows service using the Remove-Service
cmdlet. However, you see an error message like
Remove-Service : The term 'Remove-Service' 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:63 + Remove-Service + ~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Remove-Service:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Solution:
The Remove-Service
cmdlet was introduced in PowerShell version 6.x.
When you run
Get-Host | Select-Object Version
in your PowerShell, you will see that you are running an older PowerShell version, e.g.
Version ------- 5.1.19041.610
However, you can use this one liner in order to install PowerShell
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
Source for the one-liner: thomasmaurer.ch