Re: ADSI and C#

Tech-Archive recommends: Fix windows errors by optimizing your registry



Missing Children in ...
userEntry.Find

Willy.

"Victor Pereira" <taintmode@xxxxxxxxxxxx> wrote in message
news:u1hR9YxTFHA.3280@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Willy,
>
> I tried this "DirectoryEntry cEntry = userEntry.Find("admin"), but did'nt
> worked."
>
> Thanks for your reply,
>
> Victor
> "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
> news:elTPa7VTFHA.3952@xxxxxxxxxxxxxxxxxxxxxxx
>>
>> "Victor Pereira" <taintmode@xxxxxxxxxxxx> wrote in message
>> news:%235kncyPTFHA.2996@xxxxxxxxxxxxxxxxxxxxxxx
>> > Hi Willy,
>> > Thanks for your reply.. two MVPs aswering my questions.. that is a
> honor!
>> >
>> > But when you sad that i must create and delete i think your wrong and
> here
>> > is a function to proof it!
>> >
>> > void RenameUser(string hostname,string admusr)
>> >
>> > {
>> >
>> > try
>> >
>> > {
>> >
>> > DirectoryEntry entry = new DirectoryEntry("WinNT://" + hostname +
>> > ",computer");
>> >
>> > DirectoryEntry cEntry = entry.Children.Find("administrator");
>> >
>> > MessageBox.Show(cEntry.Path.ToString());
>> >
>> > cEntry.MoveTo(entry,admusr);
>> >
>> > cEntry.CommitChanges();
>> >
>> > }
>> >
>> > catch(Exception cc)
>> >
>> > {
>> >
>> > MessageBox.Show(cc.Message.ToString());
>> >
>> > }
>> >
>> > }
>> >
>> >
>> >
>> > Reguards,
>> >
>> > Victor Pereira MVP-WannaBe :-)
>> >
>>
>> Yes, but you probably know there are different ways to skin a cat, here
>> is
>> another one.
>>
>> DirectoryEntry cEntry = userEntry.Children.Find("administrator");
>> cEntry.Rename(admuser);
>> cEntry.CommitChanges();
>>
>> All depends what you realy wanna do, do you need a completely new entry
>> (that is a new SID) or do you need to keep the SID associated with a new
>> name?.
>> Note that someone who knows the SID of the original administrator, can
> also
>> find the name of the new administrator when using MoveTo and Rename.
>>
>>
>> Willy.
>>
>>
>
>


.



Relevant Pages

  • Re: ADSI and C#
    ... >> But when you sad that i must create and delete i think your wrong and ... > (that is a new SID) or do you need to keep the SID associated with a new ... > Note that someone who knows the SID of the original administrator, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ADSI and C#
    ... that is a honor! ... > But when you sad that i must create and delete i think your wrong and here ... (that is a new SID) ... Note that someone who knows the SID of the original administrator, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ADAM bindable object question
    ... and have done in the past when an auxiliary object class ... We made an exception for bindProxy objects -- the SID can only be ... for an existing entry of *arbitrary* object ... >> SDE, Active Directory Core ...
    (microsoft.public.windows.server.active_directory)
  • Re: Bye SiD
    ... The decision to remove SID is in response to the issues now outlined ... On SID people create their own entries and are responsible for keeping their entry up to date and each County is supposed to have a local administrator who can make amendments. ... Secondly if the concern is SPAM from harvesting addresses then that has not been solved at all by doing this as by leaving the database in situ and only changing the front page they have done nothing to change the situation. ... If they really are concerned about SID and committed to a replacement they it wouldn't take long to replace it by incorporating it into Membership Services. ...
    (uk.rec.scouting)
  • Account Unknown
    ... When viewing the mailbox rights of a number of our users there is an entry ... that doesn't exist in the new schema. ... any object with that SID in any of the parent objects or anywhere else in ... I have used ADSIEDIT to try to find an object with this SID without success. ...
    (microsoft.public.windows.server.active_directory)