Reputation: 3065
Using VS 2013 and VB.net.
I have a webpage and when a button is clicked a service called 'VMware Tools' should be stopped on a remote server.
My Code is as follows on the button click event
Dim server As String = "ServerName"
Dim service As String = "VMware Tools"
Dim myController As ServiceController
myController = New ServiceController
myController.MachineName = server
myController.ServiceName = service
myController.Stop()
The servername above gets replace with the server name of the server. I have rights on the server to stop and start services manually.
When I run the code above I get an error on
myController.Stop()
Stating
The specified service does not exist as an installed service
Am I missing something?
Upvotes: 2
Views: 1499
Reputation: 641
Service name needs to be the actual name of the service not the display name.
You can find that in the services.msc by double clicking on the service at the top you will see service name.
I think the name for VMware Tools is VMTools
Upvotes: 1