DirectoryEntry.NativeObject throws access denied for a user in Administrators group in windows 2008

后端 未结 1 595
猫巷女王i
猫巷女王i 2021-01-06 23:58

I have a local user, which is member of Administrators local group.

When I run this code:

using System;
using System.DirectoryServices;

namespace na         


        
相关标签:
1条回答
  • 2021-01-07 00:46

    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.

    0 讨论(0)
提交回复
热议问题