User Search Code Throws on Vista
- From: coconet <coconet@xxxxxxxxxxxxxxxx>
- Date: Tue, 08 Apr 2008 16:02:50 -0400
I am trying to create a user on a Vista Ultimate system, only if it
does not exist. This code throws:
"
The user name could not be found. (Exception from HRESULT: 0x800708AD)
"
I know the user name could not be found - that is why I am checking!
What is the proper syntax to let this check properly work.
Thanks.
string local = "WinNT://" + Environment.MachineName + ",computer";
DirectoryEntry root = new DirectoryEntry( local );
DirectoryEntry entry = null;
if (root.Children.Find("TestAccount","User") == null) // <-throws
{
// ...make new user...
}
..NET Framework 3.5 Console app.
.
- Prev by Date: RE: Load-balancing / routing with WCF
- Next by Date: Re: LINQ Conditional Where
- Previous by thread: Load-balancing / routing with WCF
- Next by thread: RE: Good C# profilers?
- Index(es):