Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: PERL en ADSI

by PerlUserNL (Initiate)
on Jan 11, 2011 at 11:35 UTC ( #881642=note: print w/replies, xml ) Need Help??


in reply to Re: PERL en ADSI
in thread PERL en ADSI

I have made a step for step plan: First I want to get the overvieuw of the users. Then I want to compare the first names. Then I want to get the output of the users with the same name. Now i need to copy the usernames to the general field.

use Win32::OLE; $ou=Win32::OLE->GetObject("LDAP://ou=Users,dc=myDomain,dc=net"); @filter=("user"); $ou->{filter}=\@filter; foreach $obj (in $ou){ print "$obj->{name}\n"; }

Above code i want to use to get the user list. But i think i did something wrong, or maybe it can be done on a easier way.

Replies are listed 'Best First'.
Re^3: PERL en ADSI
by SuicideJunkie (Vicar) on Jan 11, 2011 at 14:07 UTC

    Yep.

    Add

    use strict; use warnings;
    To the top of that code, and Perl will tell you what is technically wrong and help get the code to run.

    You will save yourself from a million headaches if you use those liberally.

    (Appended)
    PS:
    A quick look through the Win32::OLE description indicates that your code probably won't compile because "in" isn't exported by default. You probably want to add that and anything else you want to use to your use statements up top.

      use strict; use warnings; use Win32::OLE; $ou=Win32::OLE->GetObject("LDAP://ou=Users,dc=myDomain,dc=net"); @filter=("user"); $ou->{filter}=\@filter; foreach $obj (in $ou){ print "$obj->{name}\n"; }

      I add the strict en warnings by default in my scripts, But i forgot to posted it here...

        corion is correct, this code won't work at all. Perhaps you want to look at a working LDAP / Active Directory example: Help using Win32::OLE

        This code cannot compile. Please show some effort and eliminate the most obvious errors before posting.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://881642]
help
Chatterbox?
[Corion]: usemodperl: No, asking is not unreasonable. Insisting that it must always keep working for you is unreasonable.
[Corion]: But again, you haven't explained why your users need to download, or why they need to download via http, or why you can't host the SSL-stripper yourself.
[choroba]: Wait a second. Does shutting down search.cpan.org mean the cpan clients can no longer use their urllist?
[usemodperl]: i'm under no obligation to explain myself mommy, and i'm not insisting, just asking a simple question
[Veltro]: So, I'm confused on the matter actually. There are locked-down computers, but they need updates. How does that work? Isn't that contradictary?
[usemodperl]: EXACTLY
[usemodperl]: and the https only situation makes it even worse
[Veltro]: How is that 'exactly'. Locked-down means you don't change or update. So why do you need to access CPAN?
[Corion]: choroba: Heh - I think that's an interesting situation - you can't bootstrap a vanilla Perl then via CPAN, as IO::Socket::SSL is not in core, but also can't be installed from a cpan client. You need a wget/curl with SSL built-in to do that :)
[usemodperl]: i was thinking of forcing something like archive.org to proxy from meta but they seem all https too :-/

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2018-06-24 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?