Questions tagged [servicecontroller]

104 questions
0
votes
1 answer

ServiceController.Stop() doesn't appear to be stopping anything

My dev box is a Windows 7 (x64) machine. I've got some code (C#, .net 2.0) that in certain circumstances, checks to see if a service is running and then stops it. ServiceController matchedService = //My Service! //If statements and…
peacedog
  • 1,415
  • 20
  • 32
0
votes
0 answers

Finding windows services running on another machine under specific user

I am trying to get the list of windows services that is running on another machine within my network. But I am stuck in finding the list of those service, which run under specific "log on as". Please suggest if you have any idea? I accomplished the…
Justin Samuel
  • 1,063
  • 4
  • 16
  • 30
0
votes
2 answers

Apply Stop on a service that is Stopped or has another state

I am using the following function to stop my windows service (with a timeout): public int StopService() { ServiceController service = new ServiceController(serviceName); try { TimeSpan timeout =…
disasterkid
  • 6,948
  • 25
  • 94
  • 179
0
votes
2 answers

View status of service running on remote machine

The conditions are - I don't have administrator privilege - I want to see the status of a service in remote machine (server) I use the following code (vb.net with framework 2.0) to see the status Dim sqlSvc As ServiceController Svc = New…
Tun
  • 1,345
  • 13
  • 34
0
votes
1 answer

Searching the ServiceController array using Array.Findall?

I'm rusty at the moment coding in .NET again, and am trying to avoid doing a For Each loop, playing with Array.Findall. I want to grab an array of all services installed on the machine, and then pass a string to search it's Friendly Display Name for…
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
0
votes
1 answer

Change service credentials using ServiceController

Is there a way to do this, but instead of using WMI which is not currently working in my environment, using ServiceController Class. using (ManagementObject service = new ManagementObject(new ManagementPath(objPath))) { …
FerMelon
  • 93
  • 3
  • 13
0
votes
1 answer

execute command crashing on start pending status c#

I'm writing a button_click function in c#, in which i use the executeCommand to talk to a service. ServiceController sc = new ServiceController("MyService"); int command = 145; sc.Stop(); //writing xml…
dasy
  • 49
  • 1
  • 5
0
votes
1 answer

unable to install window service using 'servicecontroller'

I want to install a windows service on a remote service. In the following blog you have said to use 'servicecontroller' Installing a win32 service using MSBuild and Microsoft.Sdc.Tasks However in the 'ServiceController Members' in the .chm file of…
Prasad
  • 1
0
votes
1 answer

C# starting remote service on a virtual machine

I have a host that runs several virtual machines, on every virtual machine runs a service wich works fine locally but when i try to execute it remote from the host i get accces denied. i have searched google for a while now, impersonate doesnt work…
JackF
  • 63
  • 1
  • 9
0
votes
1 answer

Can not access the windows service description through the service controller in VB.Net

I have this Windows Service from my company : I want to get the service description from it in code behind! but for some reason it does not return the service description. Can anyone help me with this . here is my code, and what it returns : Dim…
Arrie
  • 1,327
  • 5
  • 18
  • 39
0
votes
1 answer

sc.exe config changing credentials inside OnStart of Windows Service

I want to pull credentials for a service from a database (be more dynamic) I am using sc.exe to change the credentials inside OnStart before I call .Start() on the service. The sc.exe change works, but I noticed it doesn't take effect until after I…
DavieDave
  • 1,394
  • 2
  • 18
  • 35
0
votes
0 answers

Using ServiceController or other to programmatically create an unmanaged kernel driver service

I have a C/C# mixed project composed by a kernel driver written in C and an application written in C#. Right now, to create the kernel driver service and run it, i'm using the native APIs OpenSCManager and CreateService with the interop services,…
Simone Margaritelli
  • 4,584
  • 10
  • 45
  • 70
0
votes
1 answer

'wix execute batch before uninstall with administrator

My WiX XML file installs app that contains windows-service named OLOLO_SERVICE (for example). I want to stop this service when installing/reinstalling my app. I use CustomAction with ExeCommand='sc stop OLOLO_SERVICE'.
Alex
  • 183
  • 1
  • 12
0
votes
2 answers

How do I set up the security to remotely stop and start a WCF service?

This is a long post, so here's the meat of my question up-front: I'd like to use the ServiceController class in C# to control services on another computer, but it looks like I need to impersonate an account on the service host computer to comply…
Kevin
  • 14,655
  • 24
  • 74
  • 124
1 2 3 4 5 6
7