Converting VBS scripts to Perl using OLE is really pretty easy. Yours would
probably come out something like this:
#######################
use Win32::OLE;
use strict;
my($username,$fullname,$MyOU) = @ARGV;
my $adsi =
Win32::OLE->GetObject("LDAP://cn=$username,OU=Users,ou=$MyOU,ou=Support,dc=D
IRECTV,dc=com") || die;
my $email = $adsi->Get("mail");
print $fullname."'s email address is $email.\n";
#######################
-----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