I found the following Links in MSDN to help me start and stop the window services. There is code snippet which tells it is possible to start and stop the service.
ServiceController sc = new ServiceController("Telnet");
if ((sc.Status.Equals(ServiceControllerStatus.Stopped))
|| (sc.Status.Equals(ServiceControllerStatus.StopPending)))
{
sc.Start();
}
else
{
sc.Stop();
}
sc.Refresh();
for this i need the System.ServiceProcess.dll the dll.
Namespace: System.ServiceProcess Assembly: System.ServiceProcess (in System.ServiceProcess.dll)
I am trying to add this from NUget and got the error.
Type Script command : Install-Package System.ServiceProcess.ServiceController -Pre
Error Message :
Install-Package : System.ServiceProcess.ServiceController 4.1.0-beta-23516 provides a compile-time reference assembly for System.ServiceProcess.ServiceController on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm. At line:1 char:1 + Install-Package System.ServiceProcess.ServiceController -Pre + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Servicesare not available in UWP, they're considered legacy. You should researchBackgroundTasks- Neil Turner