FTP service gets deleted on server restart

If a registry DWORD "DeleteFlag" is set to 00000001 for the FTP service (or any service ) on IIS6 server at [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFtpsvc] the service will be deleted on server restart. While this may be by design in cases when the service is uninstalled, but in such cases the service node has to be deleted from registry. If services manager is not able to delete the node for some reason and if the service is reinstalled, the "DeleteFlag" key will still be present and on server restart, the services manager will detect this key and delete the service and this may continue in a loop (reinstallation of service followed by a deletion of service on server restart).

To reproduce this issue, we can add a REG DWORD "DeleteFlag" with a value 00000001 at[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFtpsvc] on a Win 2003 server which has FTP installed and restart the server. The service will be deleted on restart.

For Win2k8 R2, IIS 7.5, the location is [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ftpsvc] but the key is same, a DWORD "DeleteFlag" set to 00000001.

This might have happened due to third party software or a bad uninstallation accompanied with some permission issues due to which the MSFTPSvc/ftpsvc key could not be deleted. The solution is to delete/rename the "DeleteFlag" key from the respective locations.