Add X500 for a user

Hi,

Add X500 for a user
I want help with adding X500 to all users in a txt file
Can anyone help.

REgards
sharath
LVL 11
bsharathAsked:
Who is Participating?
 
bsharathAuthor Commented:
I will have the txt file as
Samaccount name;/o=Group/ou=First Administrative Group/cn=Recipients/cn=Samaccountname
Samaccount i mean as Ntlogin
0
 
evetsleepCommented:
are you looking to add the x500 address to a matching sAMAccountName  in Active Directory (in the proxyAddresses attribute)?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
bsharathAuthor Commented:
Yes
0
 
bsharathAuthor Commented:
Thanks Mark its perfect
One question with the script
This line
x500Base = "/o=ExampleAB/ou=Organizationalunit1/cn=Recipients/cn="
Will the script run on every user and add like this
x500Base = "/o=ExampleAB/ou=Organizationalunit1/cn=Recipients/cn=Samaccount"
0
 
markdmacCommented:
Yes it will.
0
 
bsharathAuthor Commented:
as you stated some may faile if renamed. how can i find which failed
I have few users Samaccount that i have renamed those may fail i guess
0
 
markdmacCommented:
you would need to query against sAMAccountName and compare that to the email address.  How many users are we talking about there?  You could probably grab that info quickly with a custom AD Query in ADUC and just quickly scan the results by eye.  Or dump into Excel and use a formula to compare the two columns.
0
 
bsharathAuthor Commented:
But
Samaccounts in mine will look as
Sharathy
Email
Sharath.yui@plc.com

I have totally 5000+ users
0
 
markdmacCommented:
This is untested but hopefully will give you a list of the accounts that will be in trouble.
On Error Resume Next

Dim qQuery, objConnection, objCommand, objRecordSet, obj
Dim oRootDSE, strDomain

Set oRootDSE = GetObject("LDAP://rootDSE")
strDomain = oRootDSE.get("defaultNamingContext")

' other categories = computer, user, printqueue, group
qQuery = "<LDAP://" & strDomain &">;" & _
		"(objectCategory=person)" & _
       ";sAMAccountName,mailNickname;subtree"

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 999 
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF
	If objRecordSet.Fields("sAMAccountName") & "@domain.com" <> objRecordSet.Fields("mailNickname") Then
    	report = report & objRecordSet.Fields("sAMAccountName") & " is different from " & objRecordSet.Fields("mailNickname") & vbCrLf
    End If
    objrecordset.MoveNext
Wend

objConnection.Close

WScript.Echo report

Open in new window

0
 
bsharathAuthor Commented:
I get all the usrs listed even though they are correct
0
 
markdmacCommented:
Sorry I don't have a test environment that I can use for this at the moment.  If they are just one off instances then why not wait for someone to yell and fix them?  
0
 
bsharathAuthor Commented:
Thanks Mark...
I guess will do it on all and wait for some one who might have a mail bounce thank U
What is the time out there for you.?
Can you have a look at this please... Vbs is also fine on this
http://www.experts-exchange.com/Programming/Languages/Q_25660679.html
0
All Courses

From novice to tech pro — start learning today.