Jason

Jason

  • NA
  • 31
  • 0

C# and Services

Dec 29 2010 8:15 AM
I'm trying to use remote task scheduler and make sure the service is running on the remote machine.  I use the following.  Notice the servicename is Alerter.  That works, but when I try Task Scheduler I get an error.  I noticed that Task Scheduler is listed as a Local System instead of a Local Service in Services.  Any ideas?

                ServiceController sc = new ServiceController();
                sc.MachineName = "computer name";
                sc.ServiceName = "Alerter";
                MessageBox.Show(sc.Status.ToString());
                if (!sc.CanStop)
                    sc.Start();

Answers (8)