I have a local user, which is member of Administrators local group.
When I run this code:
using System;
using System.DirectoryServices;
namespace na
To answer my own question, so others can find a solution:
The problem is with the default UAC settings in Windows 2008. Even if a user is in the Administrators group, he/she still needs elevated privileges to run some operations (the one above appears to be among them).
So, solution 1 - run the application using "Run as administrator", or start it from a command prompt, which was started with that option.
Solution 2: Disable UAC for administrators group - I have used method #3 from this article (group policy changes). Remember to reboot the server after these changes.