Discussion:
Using WinNT provider with local computer, not domain
(too old to reply)
Bill
2005-11-11 21:12:44 UTC
Permalink
Is it possible to search through user accounts on a machine that is not part
of a Windows Domain? I thought this should be possible using
WinNT://MyComputerName as the ADsPath string.

The end result from the FindOne() function is an exception with the message:
"The provider does not support searching and cannot search
WinNT://MyComputerName."

Here is the the code snipet in VB.NET:

dirEntry = New DirectoryEntry("WINNT://myComputerName", "aUserName", "pwd",
AuthenticationTypes.Secure)
dirSearcher = New DirectorySearcher(dirEntry)
dirSearcher.Filter = "(sSamAccountName=myName)"
searchResult = dirSearcher.FindOne()

FindOne() fails with the above mentioned message.

Any help with this is greatly appreciated.
Joe Kaplan (MVP - ADSI)
2005-11-11 22:05:50 UTC
Permalink
There is no DirectorySearcher with WinNT. It is an LDAP-only thing.

Also, be aware that WinNT is case-sensitive.

Joe K.
Post by Bill
Is it possible to search through user accounts on a machine that is not part
of a Windows Domain? I thought this should be possible using
WinNT://MyComputerName as the ADsPath string.
"The provider does not support searching and cannot search
WinNT://MyComputerName."
dirEntry = New DirectoryEntry("WINNT://myComputerName", "aUserName", "pwd",
AuthenticationTypes.Secure)
dirSearcher = New DirectorySearcher(dirEntry)
dirSearcher.Filter = "(sSamAccountName=myName)"
searchResult = dirSearcher.FindOne()
FindOne() fails with the above mentioned message.
Any help with this is greatly appreciated.
Rhett Gong [MSFT]
2005-11-14 08:30:24 UTC
Permalink
I agree with the answer from Joe.

To find a user with certain name, we have to loop through dirEntry ->Children to find it by ourselves. A simple illustration is:
System.DirectoryServices.DirectoryEntry de = new DirectoryEntry("WinNT://<your computer name>");
foreach(DirectoryEntry dc in de.Children)
{
System.Diagnostics.Debug.WriteLine(dc.Name);
}

Please let me know if my answer helps you resolve the problem. If there is anything more I can assist you, please feel free to let me know.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn

This posting is provided "AS IS" with no warranties and confers no rights.
Bill J
2005-11-14 18:51:07 UTC
Permalink
Thank you Rhett and Joe. This information will definitely help.

Bill


"Rhett Gong [MSFT]" <v-***@online.microsoft.com> wrote in message news:***@TK2MSFTNGXA02.phx.gbl...
I agree with the answer from Joe.

To find a user with certain name, we have to loop through
dirEntry ->Children to find it by ourselves. A simple illustration is:
System.DirectoryServices.DirectoryEntry de = new
DirectoryEntry("WinNT://<your computer name>");
foreach(DirectoryEntry dc in de.Children)
{
System.Diagnostics.Debug.WriteLine(dc.Name);
}

Please let me know if my answer helps you resolve the problem. If there is
anything more I can assist you, please feel free to let me know.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn

This posting is provided "AS IS" with no warranties and confers no rights.
Rhett Gong [MSFT]
2005-11-17 06:05:46 UTC
Permalink
You are welcome.

Best regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn

This posting is provided "AS IS" with no warranties and confers no rights.
Loading...