tags:

views:

189

answers:

1

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.

A: 

Workaround:

I ended up creating a windows service that runs in 'local system' context, and commanding this service by WCF.

Flores