Re: ADSI and C#
- From: "Victor Pereira" <taintmode@xxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 17:49:39 -0300
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 :-)
"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:uGLKJdOTFHA.3392@xxxxxxxxxxxxxxxxxxxxxxx
>
> "Victor Pereira" <taintmode@xxxxxxxxxxxx> wrote in message
> news:e7LHNTBTFHA.2336@xxxxxxxxxxxxxxxxxxxxxxx
> > Hi Marc,
> > I want to rename the logon name. Now i changed my approach and now i'm
> > using
> > WMI. But my problem is: This code does not work in W2k, just in XP and
> > 2003.
> > Do you know how can i do it in a W2k Enviroment ?
>
> You can't call Rename on W2K, it's only supported on XP, W2K and higher.
> Only thing you can do is delete and recreate the account using
> DirectoryServices with the WinNT provider. You are also aware of the
dangers
> of renaming the administrator account do you?
>
> Willy.
>
>
.
- Follow-Ups:
- Re: ADSI and C#
- From: Willy Denoyette [MVP]
- Re: ADSI and C#
- References:
- ADSI and C#
- From: Victor Pereira
- Re: ADSI and C#
- From: Marc Scheuner [MVP ADSI]
- Re: ADSI and C#
- From: Victor Pereira
- Re: ADSI and C#
- From: Willy Denoyette [MVP]
- ADSI and C#
- Prev by Date: Label Box Wrapping
- Next by Date: Re: text file
- Previous by thread: Re: ADSI and C#
- Next by thread: Re: ADSI and C#
- Index(es):
Relevant Pages
|