views:

37

answers:

1

Hi,

I am trying to check for locked accounts in AD. In a few snippets of code, such as http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/5e0fadc2-f27b-48f6-a6ac-644e12256c67/, the code is using the DomainPolicy object, as in:

DirectoryContext context;
  DirectoryEntry root;
  DomainPolicy policy;

  public Lockout(string domainName)
  {
    this.context = new DirectoryContext(
      DirectoryContextType.Domain,
      domainName
      );

    //get our current domain policy
    Domain domain = Domain.GetDomain(this.context);

    this.root = domain.GetDirectoryEntry();
    this.policy = new DomainPolicy(this.root);      
  }

I'm using C#3.0 and the .NET framework 3.5 but I can't seem to find the DomainPolicy object, where does it sit? I've had a look and it appears it is a readonly property of HostSecurityManager.

+1  A: 

It's a custom class that is described here. It's not part of the framework.

Ronald Wildenberg