开发者

Deleting a service

开发者 https://www.devze.com 2023-03-30 11:37 出处:网络
I created an installer and custom actions for a service. On first install I managed to install the service , but when I tried running the service I got

I created an installer and custom actions for a service.

On first install I managed to install the service , but when I tried running the service I got an Error :Windows installer service cant start Error 193:0xc2

I have tried deleting this service in myriad of ways, yet on install I am still getting an error message 1001 The specified service already exis开发者_运维技巧ts.

I deleted the service directly from the registry , but this does not seem to have worked.

I have tried sc delete [service] --> The specified service does not exist as an installed service.

The service is not showing up in the registry nor is it present in installed services.

Any other thoughts or options would be appreciated


I have used this commands in a bat file that runs every time reinstalling. Try this and see.

set path=%path%;%SystemRoot%\Microsoft.NET\Framework\vXXX

InstallUtil /u YourService.exe

InstallUtil /i YourService.exe

net start "Service name"

If you want to delete/uninstall/remove a Windows service, perhaps left from an incomplete installer, you can use the sc command from an Administrator control prompt:

sc delete [servicename]

"sc delete" Deletes a service subkey from the registry. If the service is running or if another process has an open handle to the service, then the service is marked for deletion.

EDIT

I have tried sc delete [service] The specified service does not exist as an installed service.

Probably restarting the machine would fix this.


sc.exe stop serviceName
sc.exe delete serviceName

and reboot the your VM\PC


This complaint may be coming from the installer, not from Windows.

I had this same issue earlier this year, I installed a service from an MSI file, which fouled up somewhere along the line. I uninstalled the package and tried reinstalling through the installer and got the same message as you did, that the service already existed. Frustrating. It didn't show up as an installed package at all anymore, nor did it show up in the service list.

It ended up that the MSI file did not clean up after itself properly during uninstall, but that I could manually manipulate this database and remove the information myself using MSIZap.exe. You need the Windows SDK to get at this program. There may be other ways, but I don't know of them.

You will need the package guid of your installation package to remove it using MSIZap. In the same directory as MsiZap.exe, you will find another application, MsiDb.exe. Run that, point it at your MSI file, point it to some empty directory to store some exports select the "Property" table, select the "Export" radio button and hit the "OK" button. Open the "Property.idk" file that was generated by MsiDb.exe in any text editor. Look in your text for a line that says "ProductCode". The GUID that follows is what you will feed into MsiZap, brackets and all. Now you will simply (bwahaha... yeah right) enter:

msizap T {product code}

Where "{product code}" is replaced by the GUID you found. This removes all traces of your product from the MSI database in windows, which should shut the installer up.

I realize that all of this is a ridiculous pain in the butt. I don't understand why finding a product code is such a trial. But, I suppose if the uninstaller worked, you wouldn't have to do its job for it now. There really might be a simpler way to do all of this, but I haven't found one. Once I found something that worked, I was over it.

As a final note, what caused this error for me was leaving the services list open during uninstall. An uninstaller which isn't paying attention could ignore some exceptions and leave pieces of itself lying about. I was lucky, the poorly behaving uninstaller was my own. And by the way, to appreciate just how much garbage is left over from uninstallation, check out this article.

I'm not sure if I had the same problem that you had, but if so, I hope this helps. If you need clarification, ask and I'll update the answer. If I'm up a tree and this has nothing to do with your problem, I apologize.


Try with Powershell and Wmi:

(gwmi win32_service -filter "name='yourservicename'").delete()

Make sure services.msc window is closed. Sometime that messes up the service deletion. I am not sure if this will help, you should not have touched the registry!


Perhaps you tried to delete the service while it's running? In that case you might need to reboot to clear things up.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号