Click here to get back home

PERL and Active DIrectory

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
PERL and Active DIrectory gaz_5_m 06-28-2007
Get Chitika Premium
Posted by gaz_5_m on June 28, 2007, 3:25 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by QoS on June 28, 2007, 6:41 pm
Please log in for more thread options

gaz_5_m@yahoo.co.uk wrote in message-id:

>
> Hi folks,
>
> I was just wondering if anyone was using PERL to any great effect to
> query Active DIrectory.
>
> I'm in the middle of a fairly large project at work that requires
> getting (constantly changing) info from AD. I was doing the same
> things on a daily basis so thought it best to try and script it.
>
> Is there any way to directly interrogate AD from within PERL. At the
> moment, the only way I have been able to figure out is to use the
> Windows Admin Pak to call:
>
> open query, "dsquery group -name "x" | dsget group -members |";
>
> from within the script and then use the piped output of the open
> command to strip out the data that I want.
>
> It works OK, just takes a hell of a long time!
>
> The other issue I get is the default return size that is set in our AD
> environment, 1000, so groups with any larger than 1000 users return
> nothing.
>
> I know you can get round this with VB, but PERL is my language of
> choice! :-)
>
> Anyone with any tips?

Yeah you probably want to use Net::LDAP
it is part of the perl-ldap package
btw this will work with all major directory services
Netscape, AD, NDS, and Solaris Directory





Posted by gaz_5_m on July 2, 2007, 5:35 pm
Please log in for more thread options
On Jun 28, 3:41 pm, Q...@domain.invalid wrote:
> gaz_...@yahoo.co.uk wrote in message-id:
>
> > Hi folks,
>
> > I was just wondering if anyone was using PERL to any great effect to
> > query Active DIrectory.
>
> > I'm in the middle of a fairly large project at work that requires
> > getting (constantly changing) info from AD. I was doing the same
> > things on a daily basis so thought it best to try and script it.
>
> > Is there any way to directly interrogate AD from within PERL. At the
> > moment, the only way I have been able to figure out is to use the
> > Windows Admin Pak to call:
>
> > open query, "dsquery group -name "x" | dsget group -members |";
>
> > from within the script and then use the piped output of the open
> > command to strip out the data that I want.
>
> > It works OK, just takes a hell of a long time!
>
> > The other issue I get is the default return size that is set in our AD
> > environment, 1000, so groups with any larger than 1000 users return
> > nothing.
>
> > I know you can get round this with VB, but PERL is my language of
> > choice! :-)
>
> > Anyone with any tips?
>
> Yeah you probably want to use Net::LDAP
> it is part of the perl-ldap package
> btw this will work with all major directory services
> Netscape, AD, NDS, and Solaris Directory

Thanks for that. I've been having a look at the LDAP library in PERL
but I'm not as proficient in OO coding as I used to be :-) so it might
take a little time.

One of the reasons I'm looking to change is the speed issues piping
things out to dsget and dsquery. Does using LDAP prove quite speedy
(especially for large queries)?


Similar ThreadsPosted
perl with Active Directory November 2, 2005, 4:14 am
Re: PERL and Active DIrectory July 2, 2007, 9:47 pm
PERL can't open file for logging (world writable directory Windows XP Home/ Active Perl / Apache) November 8, 2006, 5:50 pm
Active Directory login User November 17, 2004, 11:23 pm
Active State Perl July 26, 2005, 7:41 pm
Active Perl: XP dll corrupted? August 1, 2005, 9:59 am
where to get Active perl modules September 1, 2005, 11:44 pm
problem with old version of (Active) Perl March 29, 2005, 3:56 pm
Active Perl Package Installation June 7, 2006, 1:53 pm
most active perl discussion forum May 28, 2007, 9:49 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap