BadMojo has asked for the wisdom of the Perl Monks concerning the following question:

Is NET::LDAP the only want to access information stored in Active Directory? I need to write a script that can write 5 reports

  1. All users in a given group
  2. All accounts that are disabled
  3. All accounts that have never logged in
  4. All accounts that must change password on next login
  5. All accounts that have never expire passwords

I know the LDAP queries for 4 of these the only query I don't know how to do is to get a list of users with in a group. Can anyone offer some insight on books, faq's, or any other resource that could help me in finding a way of doing this?

BadMojo
mford@badmojo.biz
www.badmojo.biz

!=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-!
When something works but shouldn't thats BADMOJO baby.

Replies are listed 'Best First'.
Re: Active Directory
by gellyfish (Monsignor) on Aug 10, 2005 at 12:24 UTC

    This can be done through WMI, I would have pointed you at MS Script Repository but they don't appear to have rendered all the VB Script examples from here but I think given the single example in Perl it should be simple to redo the others.

    Another possibility is Win32::AD::User which appears to do most of what you want - it uses windows native LDAP capabilities rather than an external library.

    /J\

      Very Helpfull thank you!

      BadMojo
      mford@badmojo.biz
      www.badmojo.biz

      !=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-!
      When something works but shouldn't thats BADMOJO baby.

Re: Active Directory
by strat (Canon) on Aug 11, 2005 at 06:39 UTC

    A special interface exists for ActiveDirectory (and some other directories called ADSI. Win32::AD::User ist based on this interface. At perlmonks, you'll find a lot of codes, and you can (more or less) easily translate the VBscript-codes in a lot of examples from (see M$) to Perl. You'll also find an introduction in the O'Reilly book "Perl for System Administration"

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"