Questions tagged [servicecontroller]

104 questions
0
votes
2 answers

How do I know the Description of the service that is running in remote machine in C#?

I know the service that is running using ServiceController sc = new ServiceController(); ServiceController.GetServices(DropDownListMachineName.SelectedValue)) but ServiceController does not contain any method or property to get the Description of…
0
votes
1 answer

Can't access ServiceController (InvalidOperationException) when trying to read on remote/another computer

I have a local service running on my computer and trying to get other computers to be able to read the status of my service (whether it's running, stopped, etc.) However, I am unable to as I get an InvalidOperationException error, saying that I am…
Tim
  • 41
  • 8
0
votes
1 answer

C# ServiceController not finding service when lookup uses parameter instead of hardcoded string

I'm having some issues with finding a service running on my local machine, but only when I'm using the parameter string instead of a hardcoded string (which I added to debug the problem). My method looks like this: public bool…
Jeroen
  • 1,625
  • 3
  • 16
  • 28
0
votes
1 answer

Console app to start remote service fails for some users

I know this question has been asked in multiple variations, but I'm currently at my wits' and googling prowess' end. I have written a Console application to restart a service on a remote machine. Other users in our domain also need to be able to…
LocEngineer
  • 2,847
  • 1
  • 16
  • 28
0
votes
1 answer

SC StartService Failed 1053 while running a batch file as a service

I'm trying to run my batch file(run.bat) as a windows service using Service controller This is the command I used to create my Service sc \\myservername create myservicename binPath="C:\Program Files\Directories to use\ANI\run.bat" start=auto [SC]…
Rose
  • 1,490
  • 5
  • 25
  • 56
0
votes
1 answer

using ServiceController class to find out struck or hung service

I am using ServiceController to get the list of services and its status. Below is the sample code: var scServices = ServiceController.GetServices(machineIPOrName).ToList(); var scservice = scServices.FirstOrDefault(i =>…
0
votes
0 answers

How can I take windows services list from multiple servers?

I have a three servers and I want windows servers list these servers. for one server I writing this code and I listing Windows server names and status. ServiceController.GetServices(); How can I do with multiple servers?
0
votes
1 answer

How to enable Live Service Controller Reporting?

Application Screenshot: Application Code: Dim myController As New System.ServiceProcess.ServiceController("SQL Server (SQLEXPRESS)") Sub ed() If txtNum.Text = "Started" Then btnStart.Enabled = False btnStop.Enabled = True …
0
votes
2 answers

How to run exe as window service using c#

I am trying to run an exe file as window service. I have done it before manually by doing like this: sc create TestService binPath= "C:\MyExePathWhichIsToBeRunAsWindowService" and it could worked properly, when i see the services i am able to find…
struggling
  • 535
  • 1
  • 10
  • 25
0
votes
1 answer

SQL service not started properly using ServiceController

I'm writing an app to automatically restart an SQL service. Basically, these are the steps I am doing: Close application Stop SQL service Start SQL service Start application The problem I have is with starting the application. It seems that the…
jmc
  • 1,649
  • 6
  • 26
  • 47
0
votes
1 answer

Unable to catch ServiceController.Start() exceptions in calling thread

How can i catch the exception that occurs when starting a windows service. I am unable to get the exception here in my below code even though i am throwing exception in the Onstart() method of the service. public class InterOpIntegrationWinService :…
battech
  • 803
  • 2
  • 13
  • 25
0
votes
1 answer

ServiceController in a Windows Service

I'm trying to use ServiceController.GetServices() method to get the list of all the services. In a console application, it works OK, but I get an empty list if I call this method in a windows service. That seems an authentication issue, but I used…
Feyyaz
  • 3,147
  • 4
  • 35
  • 50
0
votes
1 answer

ServiceController API will not recognise that a service has stopped

I'm working on an installer that copies files into Program Files and then runs a service (via one of the files that was copied over). On the first installation this will work with no problems, but issues start to occur when the installer is run and…
Oliver Nicholls
  • 1,342
  • 12
  • 24
0
votes
1 answer

Using Service Controller in Classic ASP

I'm currently trying to see if I can use ServiceController in my Classic ASP page so that the page can send custom commands to my Windows Service. All the articles and questions I have read online were about using ASP.NET or another…
John Odom
  • 1,189
  • 2
  • 20
  • 35
0
votes
1 answer

Instantiating ServiceController takes sometimes too much time

i am creating an instance of ServiceController using a remote/local machine name and the name of the service. When I type sth. like stackoverflow.com as machine name the contructor blocks for a long time and returns an exception. Example: string…
mrbamboo
  • 1
  • 1