JSI Tip 9178. How do I reinstall Microsoft Distributed Transaction Coordinator on a computer that is running Windows XP?

Jerold Schulman

March 21, 2005

2 Min Read
ITPro Today logo in a gray background | ITPro Today

You would not normally have to reinstall MS DTC on Windows XP because it's files are protected by WFP (Windows File Protection).

If you find a need to reinstall MS DTC, Microsoft has written a Knowledge Base Article, 891801 - How to reinstall Microsoft Distributed Transaction Coordinator on a computer that is running Windows XP.

Unfortunately, the processes that the article describes can take you hours to accomplish.

I have written 3 scripts to allow you to accomplish the required tasks in only a few minutes.

To reinstall MS DTC by using these scripts, perform the following steps:

1. Make sure that all transactions have completed.

2. Open a CMD.EXE window and type MSDTC1 Filename, where Filename is the full path to a file that will be created to restore all services to their current Start value.

3. Shutdown and restart Windows XP.

4. Open a CMD.EXE window and type MSDTC2.

5. When step 4 finishes, and all disk activity stops, type MSDTC3 FileName, where Filename is the full path to the file that you created in step 2.

6. Shutdown and restart Windows XP.

7. Open a CMD.EXE window and type %WINDIR%System32msdtc.exe -resetlog.

MSDTC1.bat contains:

@echo offif {%1}
{} @echo Syntax: MSDTC1 Filename&goto :EOFsetlocal ENABLEDELAYEDEXPANSIONset filename=%1if exist %filename% del /q %filename%(@echo Alerter@echo EventSystem@echo Browser@echo TrkWks@echo Dnscache@echo Eventlog@echo PolicyAgent@echo dmserver@echo Messenger@echo Netlogon@echo NtLmSsp@echo Netman@echo PlugPlay@echo RpcSs@echo RpcLocator@echo NtmsSvc@echo SamSs@echo lanmanserver@echo SENS@echo Schedule@echo LmHosts@echo winmgmt@echo Wmi@echo W32Time@echo lanmanworkstation)>"%TEMP%MSDTC1.TMP"call :stopdtc>nul 2>&1for /f "Tokens=*" %%L in ('reg query HKLMSystemCurrentControlSetServices^|FINDSTR /I /B /L /C:"HKEY_LOCAL_MACHINE"') do ( set line=%%L set key=HKLM!LINE:~18! call :subkey "!key!" call :testsvc)endlocalgoto :EOF:stopdtcsc stop msdtcgoto :EOF:testsvcfor /f "Tokens=*" %%c in ('@echo !svc!^|findstr /I /B /E /L /G:"%TEMP%MSDTC1.TMP"') do goto :EOFset /a start=3set /a type=0call :getstart>nul 2>&1call :gettype>nul 2>&1if %type% LSS 16 goto :EOFif %start% NEQ 2 goto :EOFsc config !svc! start= demand@echo sc config !svc! start= auto>>%filename%goto :EOF:gettypefor /f "Tokens=2,3" %%x in ('reg query "HKLMSystemCurrentControlSetServices!svc!" /V type^|FIND "REG_DWORD"') do ( set /a type=%%y)goto :EOF:getstartfor /f "Tokens=2,3" %%x in ('reg query "HKLMSystemCurrentControlSetServices!svc!" /V start^|FIND "REG_DWORD"') do ( set /a start=%%y)goto :EOF:subkeyset svc=%~nx1

MSDTC2.bat contains:

@echo offsetlocal@echo %WINDIR%System32msdtc.exe -uninstall%WINDIR%System32msdtc.exe -uninstallcall :delkey "HKCRCID"call :delkey "HKLMSYSTEMCurrentControlSetServicesMSDTC"call :delkey "HKLMSYSTEMControlSet001ServicesMSDTC"call :delkey "HKLMSYSTEMControlSet002ServicesMSDTC"call :delkey "HKLMSoftwareMicrosoftMSDTC"@echo %WINDIR%System32msdtc.exe -install%WINDIR%System32msdtc.exe -installendlocalgoto :EOF:delkeyset key=%1call :delkeyq %key% >nul 2>&1@echo. goto :EOF:delkeyqREG DELETE %key% /F

MSDTC3.bat contains:

@echo offif {%1}{} @echo Syntax: MSDTC3 Filename&goto :EOFif not exist %1 Syntax: MSDTC3 Filename - %1 was NOT found.&goto :EOFsetlocalset filename=%1for /f "Tokens=*" %%r in ('type %filename%') do ( %%r)reg add "HKLMSOFTWAREMicrosoftMSDTCXADLL" /Fregsvr32 mtxoci.dllendlocal



Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like