views:

86

answers:

1

Hello, we have some Setup Project wrote in Visual Studio 2008 in C# that installs and uninstalls services with ServiceInstaller class.
When I install the services this don't get too much time, but when I uninstall with following code the process for each service get few seconds (and we have many services):

ServiceInstaller si = new ServiceInstaler();
string path = string.Format("/assemblypath={0}", strServiceExecutablePath);
string[] cmdline = { path };

InstallContext context = new InstallContext(string.Empty, cmdline);
si.Context = context;
si.ServiceName = strServiceName;
si.Uninstall(null);

Some one know why?

Here I want to ask some related question.
What difference between working of:

InstallUtill /u exePath

when it uninstall service and:

sc delete serviceName

And why when I delete some record from registry from CurrentControlSet\services I still see the service in services.msc but with:

<Failed to read description. Error code:2

In description?
From where I need to delete service manually for delete it complitely?
Thank you for ahead.

A: 

InstallUtil /u exePath will uninstall an application by calling the uninstaller part of your setup.

sc delete serviceName will delete a service subkey from the registry. It does not uninstall an application - but can be part of an uninstall procedure.

Regarding your Failed to read description. Error code:2 error see this post. Most likely you only crippled your service but did not uninstall it. Run sfc /scannow and check the log.

Ando
Thank you for replay. I read the linked forum thread, and I see that it is not my case. There the problem is like I see, that GPO don't download the file, but my problem is, that after I remove the key from registry, services.msc still remember the record in some other place (may be in some hidden file that must be checked by sfc), so my question is: where else Windows stores information about services?
rodnower