8
Answers

C# and Services

Jason

Jason

14y
2.3k
1
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)