[grand-rapids-pm-list] Username from Active Directory

Davis, Ryan rdavis at fbinsmi.com
Tue Mar 13 10:58:34 PDT 2007


I am trying to have a perl cgi script running on our intranet obtain the username/userid from Active Directory.   
 
Our environment here has AD used throughout the enterprise.  The web server involved is IHS (IBM Http Server - based on Apache) running on Win2000.  Again this is only used by internal users.
 
I've written this as a script using Win32::OLE.  Here's the code:
 
   print ("Content-Type: text/html\n\n<html><head></head><body>");
 
   my $sysinfo = Win32::OLE->new('ADSystemInfo') || print ("<BR>Error line 18<BR>");
   my $username=$sysinfo->{UserName};
   my $adsuser = Win32::OLE->GetObject("  <ldap://$username> LDAP://$username") || print ("<BR>Error line 24<BR>");
   my $name = $adsuser->{cn};

   print ("Username:$username<BR>Name:$name<BR>"); 
   print ("</body></html>");
 
 
When I run this on my own workstation everything works as I would like.  When I run it on the server as a cgi, the username comes back blank.  I suspect that the cgi is running without AD information available, but am told otherwise by technical resources here.
 
Is there any way to get the username in this situation?

Ryan Davis 
Web & Agency Support 
x1540 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/grand-rapids-pm-list/attachments/20070313/a3d48c2e/attachment.html 


More information about the grand-rapids-pm-list mailing list