Interact with Windows Services on Another Computer
Problem
You need to start or stop a service that is running on another computer.
Solution
Create a ServiceController instance using the constructor that accepts a machine name. You can then use the Stop and Start methods of the ServiceController class.
Discussion
You can create a ServiceController instance that represents a service running on another computer, provided that you have the required network rights, by specifying the computer name in the ServiceController constructor. Here’s one example:
Dim TestService As New ServiceController("TestService", " ComputerName")
You can also use GetServices or GetDevices to retrieve service information from another computer by supplying a machine name.
Dim Services() ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.