Ошибка: учетные данные пользователя не могут быть использованы для локальных подключений WMI C#
Я пытаюсь подключить удаленный сервер для мониторинга службы windows, но получаю исключение "
User credentials cannot be used for local connections".
ни уверен, что не так с кодом, пожалуйста, помогите
Что я уже пробовал:
ConnectionOptions con=new ConnectionOptions(); con.Impersonation = ImpersonationLevel.Impersonate; con.Authentication = AuthenticationLevel.Default; con.Username = "admin"; con.Password = "pass"; con.Authority = "ntlmdomain:ServerName"; con.EnablePrivileges = true; ManagementScope scope = new ManagementScope(new ManagementPath(@"\\ServerName\root\cimv2"), con); scope.Connect(); ObjectQuery query=new ObjectQuery("SELECT * FROM Win32_Service WHERE Name = 'MyService'"); ManagementObjectSearcher searcher=new ManagementObjectSearcher(scope,query); foreach (ManagementObject qObj in searcher.Get()) { Console.Write(qObj["Status"]); Console.Write(" : "); Console.WriteLine(qObj["Status"]); }