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

use Win32::AD::User; $connect = Win32::AD::User->new("WinNT://ad.domain/admin-user,user","u +ser-name"); $connect->get_info(); $property = $connect->get_property('middleName');
Gives me an error:
Win32::OLE(0.1712) error 0x80020003: Member not found in METHOD/PROPERTYGET "middleName" at C:/Perl/site/lib/Win32/AD/User.pm
While, I know, that the connection to Active Directory works, because, when I try to get a list of groups the user belongs to, it lists:
use Win32::AD::User; $connect = Win32::AD::User->new("WinNT://ad.domain/admin-user,user","u +ser-name"); $connect->get_info(); @groups = $connect->get_groups(); print join("\n\t", @groups);

Replies are listed 'Best First'.
Re: problem with getting Active Directory user properties with library Win32::AD::User
by NetWallah (Canon) on Oct 16, 2016 at 05:56 UTC
    If I understand the documentation right, "middleName" is an LDAP property that is obtained by calling the User object METHOD "OtherName" - so you may have to do:
    $property = $connect->get_property('OtherName');
    *Untested*

            ...it is unhealthy to remain near things that are in the process of blowing up.     man page for WARP, by Larry Wall

Re: problem with getting Active Directory user properties with library Win32::AD::User
by soonix (Chancellor) on Oct 17, 2016 at 08:04 UTC
    Neither in SelfADSI nor in MSDN can I find an attribute "middleName".

    Do you perhaps mean Initials (which seems to be used for the "middle initial")?

      If you go to Attributes Editor in user properties in Active Directory "Users and Computers", there is a lot of attributes. One of them is "middleName". "initials" is also there.

        Indeed. the MSDN "All Attributes" list that I referenced is indexed by "CN", while the Attributes Editor shows the "Ldap-Display-Name"

        So NetWallah's answer is probably closer. OTOH the "Initials" field is shown in the "general" user properties, and the "Other-Name" (middleName) field is not.