RE: [PHP-WIN] Add user to Active Directory
| From: | Bowden, Zeb | Date: | Mon, 01 Dec 2003 14:02:12 +0000 |
| Subject: | RE: [PHP-WIN] Add user to Active Directory | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-22247@lists.php.net to get a copy of this message | ||
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: [PHP-WIN] 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