Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created April 24, 2013 15:24
Show Gist options
  • Save fapestniegd/5452979 to your computer and use it in GitHub Desktop.
Save fapestniegd/5452979 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use Net::LDAP;
my $ldap = Net::LDAP->new( 'ldaps://faraday.eftdomain.net:636' ) or die "$@";
my $mesg = $ldap->bind( "uid=$ENV{'LOGNAME'},ou=People,dc=eftdomain,dc=net", password => "$ENV{'LDAP_PASSWORD'}");
$mesg = $ldap->search( base => 'ou=Card@Once,dc=dev,dc=eftdomain,dc=net', filter => "(ou=erik*)");
foreach my $entry ($mesg->entries) {
$entry->dump;
$mesg = $ldap->delete($entry->dn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment