bsharath
asked on
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
Add X500 for a user
I want help with adding X500 to all users in a txt file
Can anyone help.
REgards
sharath
are you looking to add the x500 address to a matching sAMAccountName in Active Directory (in the proxyAddresses attribute)?
ASKER
Yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Mark its perfect
One question with the script
This line
x500Base = "/o=ExampleAB/ou=Organizat ionalunit1 /cn=Recipi ents/cn="
Will the script run on every user and add like this
x500Base = "/o=ExampleAB/ou=Organizat ionalunit1 /cn=Recipi ents/cn=Sa maccount"
One question with the script
This line
x500Base = "/o=ExampleAB/ou=Organizat
Will the script run on every user and add like this
x500Base = "/o=ExampleAB/ou=Organizat
Yes it will.
ASKER
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
I have few users Samaccount that i have renamed those may fail i guess
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.
ASKER
But
Samaccounts in mine will look as
Sharathy
Email
Sharath.yui@plc.com
I have totally 5000+ users
Samaccounts in mine will look as
Sharathy
Sharath.yui@plc.com
I have totally 5000+ users
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
ASKER
I get all the usrs listed even though they are correct
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?
ASKER
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
https://www.experts-exchange.com/questions/25660679/Powershell-script-to-create-groups-and-add-members.html
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
https://www.experts-exchange.com/questions/25660679/Powershell-script-to-create-groups-and-add-members.html
ASKER
Samaccount name;/o=Group/ou=First Administrative Group/cn=Recipients/cn=Sam
Samaccount i mean as Ntlogin