Hi
I am trying to stop a windows service in a server(on different domain) from my C#.NET windows application using ServiceController
I am getting following error
Inner Exception:
{"Access is denied"}
Exception Message:
"Cannot open Service Control Manager on computer 'x.y.z.a'. This operation might require other privileges."
Enviroment:
Windows application running on Windows 7, C#.NET, 3.5 on "ABC" DOMAIN
Target service running on Windows 2003 server. on "XYZ" DOMAIN
Port 445,135 opened between two systems
Code:
ServiceController lo_WinSC = new ServiceController();
lo_WinSC.MachineName = "SYSTEMIPAddress";
lo_WinSC.ServiceName = "ServiceToBeStopped";
Some forum suggesting to impersonate account of target domain but failed to Impersonate. Error: "The security database on the server does not have a computer account for this workstation trust relationship"
Question 1: Is it possibile to impersonate account of different domain. i.e My application running on "XYZ" domain, I would like to impersonate an account "ABC" domain. Note: Port LDAP port 389 is opened between two systems. Is possbile, help me with the above error. If not, any suggestions for my primary problem.
Question 2: For impersonating any specific port needs to be opened between application system and Domain controller/target server.
Question 3: Is there any other way to solve my primary problem or Is there any way to pass login credentail in ServiceController