Saturday, May 30, 2009

How to UnRegister .NET Windows Service ?


Use the below script to unregister a windows Service.

Step 1: Create a batch file (eg., UnRegister.bat) and put it in the same foler where your windows service executable file resides).

Step 2: Copy the below script and paste it in above "UnRegister.bat" file.

@ECHO OFF

REM The following directory is for .NET 2.0
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
set PATH=%PATH%;%DOTNETFX2%

echo UnInstalling WindowsService...
echo ---------------------------------------------------
net stop WINDOWS_SERVICE_NAME
InstallUtil /u WINDOWS_SERVICE.EXE
echo ---------------------------------------------------
pause
echo Done.

Step 3: Replace your windows Service executable file with "WINDOWS_SERVICE_NAME" and "WINDOWS_SERVICE.EXE" string.

Step 4: Save -> Exit from the file. Now the batch file is reay to uninstall the windows service. Just double click the "UnRegister.bat" file.

No comments: