I thought I was being a bit clever some time back when I wrote a little .NET wrapper for performance counters, largely for the reason of allowing clients to happily work with counters that weren’t installed on their machine. The default behaviour is an exception when you attempt to use a non-existant counter.
This was all good until deployment to servers and clients with ‘real’ non-admin users. I then read that only administrators and power users could increment counters (awww!).
I just found this MS article that explains how to get around this as the ‘permissions’ are simply based on registry permissions for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib.
To set the permissions,
- Open Regedit to that key
- Right-click, select ‘Permissions…’
- Add your user’s groups or specific name with ‘Full Control’
I can now actually implement the solution (1 year on!)