Cannot find service when attempting to remotely stop via Powershell / MSBuild Cannot find service when attempting to remotely stop via Powershell / MSBuild powershell powershell

Cannot find service when attempting to remotely stop via Powershell / MSBuild


It appears that nothing is being passed from the MSBuild target file to the powershell script. You are defining the name of the service involved via ' marks, so its taking that rather than what the MSBuild target file is doing.

I would suggest you find out how to pass this variable, otherwise the script won't be able to pick this up correctly.


I'm making a complete stab in the dark, but your service name needs the TopShelf instance name including when you call get-service.

For example your service might be called "MyWindowsService" but what you need to programmatically look for is "MyWindowsService$default"