Hi,
I have requirement to restart MSDTC service on a remote server throw code of my application . Could you please help me through a code example.
Thanks and Regards ShaBeg
Hi,
I have requirement to restart MSDTC service on a remote server throw code of my application . Could you please help me through a code example.
Thanks and Regards ShaBeg
This should do the trick
System.ServiceProcess.ServiceController sc =
new System.ServiceProcess.ServiceController("Distributed Transaction Coordinator", "MachineName");
sc.Stop();
sc.Start();
The account under which the code is running will need to have admin rights on the remote box though. If not, you can do impersonation before running the code to impersonate a user with admin rights on the remote box.
MSDN info on the ServiceController class:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx