What's the problem with WinNT?
Why don't you just attempt to bind to "WinNT://DOMAIN/accountname,user" and error trap
with the ADSI return codes? You can still use LDAP to create the account and all -
but just use WinNT to test. I've found that a lot of things are a lot easier with
WinNT for simple tasks. Of course, it does not support as many methods or properties
as LDAP.
If you're still bent on LDAP, you have to do an ADO search:
'set username variable
userName = inputBox("Enter account name: ","Check account")
'modify query string to find username
query = "select AdsPath from 'LDAP://dc=oxynet,dc=oxy,dc=edu' where objectclass='User'
and samAccountName = '" & userName & "'"
'execute query string to find userpath
set recSet = adoconnection.execute (query)
do while not recSet.eof
'Get the LDAP path to the found user using recSet.fields().value
userPath = recSet.Fields("AdsPath").value
'use moveNext to advance to the next record
recSet.moveNext
loop
if userPath then
msgbox "Account Exists!"
end if
~Alex
-----Original Message-----
From: Adam Berns [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 4:05 PM
To: NT 2000 Discussions
Subject: vbs script to create new users
I am working on creating a script that will create new users. The problem
I am having is finding out if the user account already exists. I want to
keepit strictly LDAP complaint. Anyd ideas? Thanks!
------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to %%email.unsub%%
------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]