You'll want to use the ServiceController class from System.ServiceProcess. A simple example:
using System;
using System.ServiceProcess;
public class ServiceUtil
{
public static void StopService(string pName)
{
try
{
ServiceController sc = new (pName, Environment.MachineName);
if (sc.Status == ServiceControllerStatus.Running) sc.Stop();
}
catch (ArgumentException)
{
}
}
}