Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: PERL en ADSI

by wazoox (Prior)
on Jan 11, 2011 at 11:12 UTC ( #881641=note: print w/replies, xml ) Need Help??


in reply to PERL en ADSI

This smells like homework... What did you do so far? BTW you should edit your text out of the code tags. See also How do I post a question effectively?.

Replies are listed 'Best First'.
Re^2: PERL en ADSI
by PerlUserNL (Initiate) on Jan 11, 2011 at 11:35 UTC

    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.

      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...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://881641]
help
Chatterbox?
[ambrus]: GotToBTru: wait, you tell only the atom totals of what you want? Is that like ordering food in a restaurant by telling only the nutrient amounts you need, or
[ambrus]: like when a medieval scientist supposedly proves his priority inventing something by having previously published an anagram of a thousand letters long summary of the invention?
[choroba]: Progress! Nowadays, you can write a Perl script to generate such an anagram!
[GotToBTru]: i like to order my chemicals a-la-carte ambrus ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2016-12-06 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (104 votes). Check out past polls.