I want to control (start and stop) a windows service which is in the remote machine. I can connect that machine but I can't access to windows service. Here is my code. Can you help me?
ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = "****";
oConn.Password = "****";
ManagementScope managementScope = new ManagementScope(@"\\***.***.***.***\root\CIMV2", oConn);
managementScope.Connect();
RelatedObjectQuery roq = new RelatedObjectQuery("Win32_Service.Name='KanAktarim'");
ManagementObjectSearcher moSearcher = new ManagementObjectSearcher(managementScope, roq);
ManagementObjectCollection mbCollection = moSearcher.Get();