You can use Win32::OLE and convert that script to perl... use Win32::OLE;
$ldapstr = "LDAP://cn=" . $strusername . ",OU=Users,ou=" . $strMyOU .",ou=Support,dc=DIRECTV,dc=com"; $objUser = Win32::OLE->new("ADsNamespaces"); $objUser->GetObject($ldapstr); if (Win32::OLE->LastError() != 0) { print Win32::OLE->LastError(); exit 0; } $strmail = $objUser->Get("mail"); print "email: " . $strmail . "\n"; This should work providing I don't have any glaring syntactical errors (and providing that script worked in VB... But, it looks good..). Steven -----Original Message----- From: Messenger, Mark [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 1:43 PM To: 'AS-Win32-Admin' Subject: Pulling Email Address from ADSI? Does anyone know a way to use Win32::OLE (or any other module, for that matter) to pull the Active Directory field known as "E-mail" in AD Users and Computers? (The SMTP address associated with an account) Up to this point, I've been shelling out to a VBS (I feel dirty). A snippet follows, as it may be of assistance: On Error Resume Next set objArgs=WScript.Arguments strusername=objArgs(0) strfullname=objArgs(1) strMyOU=objArgs(2) ldapstr="LDAP://cn=" & strusername & ",OU=Users,ou=" & strMyOU & ",ou=Support,dc=DIRECTV,dc=com" Set objUser = GetObject (ldapstr) objUser.GetInfo strphnum = objUser.Get("mail") WScript.echo "email: " & strphnum & " ##$" Danke :) _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
