I´m having a problem whenever i try to use WMI services on a virtual pc running a 2003 Server.
The error message that i get is 'Access Denied'. I have already checked the permissions of the user over the COM components. The curious thing is that i´m running both WMI service and my app as Administrator user, so i don´t think i have trouble with permissions.
Can Anyone help me??
Thanks you very much.
The problem is on this block:
ManagementEventWatcher watcher;
try
{
numeros = devolverRandomicos();
string nros = "";
foreach (int num in numeros)
{
nros = nros + " " + num.ToString();
}
MessageBox.Show(nros);
watcher = new ManagementEventWatcher("root\\OnGuard", dataQry);
watcher.EventArrived += WMIEventArrieved;
watcher.Start();
}
catch (Exception e)
{
MessageBox.Show("ERROR CREANDO EL WATCHER: \n" + e.Message,"CatchToyota",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
The problem at last was in the Domain Users I was using to log in. After getting the machine out of the domain, all started to work just fine.
I guess it was a problem with permissions on domain users.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.