I am trying to write a PowerShell script to stop services on the local machine.
When I run the get-service cmdlet it works as expected. When I use the stop-service cmdlet, It errors stating that no service exists with the name I specify. If this was true surely the get-service cmdlet would throw the same error.
Get-Service "Service 1" # Returns Service and status Stop-Service "Service 1" # Throws error below: Stop-Service : Service 'Service 1' cannot be stopped due to the following error: Cannot open Service 1 service on computer '.'. Is there a trick when using the stop-service cmdlet?