Re: Some or all identity references could not be translated.
- From: "Joe Kaplan" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Jun 2008 22:32:08 -0500
It seems like the key for you is to ensure that you always use the same DC
for doing your write operations, so it would likely be a good idea to use
fixed DC names for this particular app.
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Darko Bazulj" <darko.bazulj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:83B8CA3C-B80B-4ECB-9E03-9786AA727641@xxxxxxxxxxxxxxxx
Hi Joe,
I will try to explain better.
First I create OU then inside that OU I create otheres OUs, users and
groups.
But sometimes I get error "There is no such object on the server", like
there is no OU which I just created.
To create users and groups I use
"System.DirectoryServices.AccountManagement" class.
http://msdn.microsoft.com/en-us/library/bb348316.aspx
Dim ctx As New PrincipalContext(ContextType.Domain, strDNSADDomain, strOU)
Dim user As New UserPrincipal(ctx)
strOU = DN - name of newly created OU in which I want to create user
strDNSADDomain = I set empty string, domain name or full DNS DC name
If I set empty string or domain name the error occurs often.
But if I set full DNS DC name the error occurs from time to time when I
start to use application, then I just enter DNS name of second DC and code
start to work.
If I put some sleep(20-30sec) in code the application work but I think
that there is some better way.
hmm...
I think I know where is the problem.
Problem is in creation of OU.
When I create OU I don't bind to specific DC but for path enter
"LDAP://OU=name,DC=domain,DC=loc"
Maybe if I enter "LDAP://DC1.domain.name:389/OU=name,DC=domain,DC=loc"
But is this good approach, what if this DC stop to work?
Can you suggest what is the good way to create OU and user inside newly
created OU and to avoid problem with AD replication?
Is there some trick like with SID/user name?
Thank you for your help.
--
"Darko Bazulj" <darko.bazulj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:15AB08F9-9201-4925-BE5A-4AE0AB5B7888@xxxxxxxxxxxxxxxx
Hi Joe,
it works now :))
Thank you for help.
Can you suggest me something about AD.
what I do:
create OU and then create user.
But I sometimes recive error, like there is no OU which I just created
but OU is there
strDNSADDomain=
I was put just domain(domain.loc) but I then recived error frequently.
Then I put full DC name(ad1.domain.loc) but mistakes were reduce but
nevertheless knows happen.
Can you suggest something??
Code:
----------
create user:
Dim ctx As New PrincipalContext(ContextType.Domain,
strDNSADDomain, strOU)
Dim user As New UserPrincipal(ctx)
user.SamAccountName = strSamAccountName
If Not String.IsNullOrEmpty(strDescription) Then user.Description
= strDescription
user.SetPassword(strPassword)
user.Enabled = True
user.PasswordNeverExpires = True
If Not String.IsNullOrEmpty(strUPN) Then user.UserPrincipalName =
strUPN
user.Save()
user.Dispose()
ctx.Dispose()
create OU:
Dim objAD As DirectoryEntry
Dim objOU As DirectoryEntry
strOU = "OU=" + strOU
objAD = New DirectoryEntry(strPath)
objOU = objAD.Children.Add(strOU, "OrganizationalUnit")
If Not String.IsNullOrEmpty(strDescription) Then
objOU.Properties("description").Add(strDescription)
If Not String.IsNullOrEmpty(struPNSuffix) Then
objOU.Properties("uPNSuffixes").Add(struPNSuffix)
objOU.CommitChanges()
objOU.Dispose()
objAD.Dispose()
Error:
-------
There is no such object on the server. -- at
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
at
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()
at
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
at
System.DirectoryServices.AccountManagement.PrincipalContext.ContextForType(Type
t) at
System.DirectoryServices.AccountManagement.Principal.GetStoreCtxToUse()
at
System.DirectoryServices.AccountManagement.Principal.set_SamAccountName(String
value) at serviceprovisioning.ActiveDirectory.CreateUser(String
strSamAccountName, String strPassword, String strOU, String
strDescription, String strUPN, String strDNSADDomain)
.
- Follow-Ups:
- Re: Some or all identity references could not be translated.
- From: Darko Bazulj
- Re: Some or all identity references could not be translated.
- References:
- Some or all identity references could not be translated.
- From: Darko Bazulj
- Re: Some or all identity references could not be translated.
- From: Joe Kaplan
- Re: Some or all identity references could not be translated.
- From: Darko Bazulj
- Re: Some or all identity references could not be translated.
- From: Joe Kaplan
- Re: Some or all identity references could not be translated.
- From: Darko Bazulj
- Some or all identity references could not be translated.
- Prev by Date: Re: Lightweight logon? Impersonation? - shared workstation problem
- Next by Date: Re: Some or all identity references could not be translated.
- Previous by thread: Re: Some or all identity references could not be translated.
- Next by thread: Re: Some or all identity references could not be translated.
- Index(es):
Relevant Pages
|