RE: Add user to Active Directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There probably is a way to do it with ldap but unless you're trying to
build a platform independent solution I think you'll be better off using
ADSI/COM

This code is very basic but it will create a new AD user account:

//open our new com object
$objcont = new COM("LDAP://server.domain.com/dc=domain,dc=com";) or
die("could not connect");

//create the user
$usr = $objcont->Create("user", "CN=newuser");

//this should print Object
echo "user = $usr";

//samaccountname is required
$usr->Put("samAccountName", "newuser");

//set it
$usr->SetInfo(); 



-----Original Message-----
From: John [mailto:jpoz@quickscribble.com] 
Sent: Wednesday, November 26, 2003 5:59 PM
To: php-windows@lists.php.net
Subject:  Add user to Active Directory

Hey all,

I'm trying to add a user to Active Directory with PHP. I'm running
apache
1.3.29 and PHP (latest) on Windows 2000. I also have LDAPS working. I
can query AD, search it, even modify attributes for existing users, but
the two pieces of code I've tried don't seem to work. One is from the
LDAP_ADD portion of the PHP manual (site is down at the moment), and
another is from some guy's website which says to use LDAP_MOD_ADD.

Does someone know how to do this? If so, could you please share your
code?

Also, how do you change a user's password in AD with PHP?

Thanks,
John

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux