C# WMI Eventwatcher code stopped working on Windows 7 with security exception
Posted
by Flores
on Stack Overflow
See other posts from Stack Overflow
or by Flores
Published on 2010-03-26T08:39:23Z
Indexed on
2010/03/26
8:43 UTC
Read the original article
Hit count: 438
This is code that worked fine on Windows XP for years. User is not local administrator.
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace");
ConnectionOptions co = new ConnectionOptions();
co.EnablePrivileges = true;
ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(@"root\cimv2",co), query);
watcher.EventArrived += StopEventArrived;
watcher.Start();
This throws an SecurityException on Windows 7, Access Denied when running as a non admin. On XP this works fine without being admin.
On this link MS states that 'Windows 7: Low-integrity users have read-only permissions for local WMI operations.'. I guess this is the problem.
But I can't find any clue on how to change this.
© Stack Overflow or respective owner