farhadtolooie
asked on
how I retreive computernameof clients in activedirectory ?
i wrote these :
Dim management_object As ManagementObject
Dim m_local_domain_name As String
Dim m_local_computer_name As String
For Each management_object In queryCollection
m_local_domain_name = management_object("Domain" )
m_local_computer_name = management_object("Name")
Next management_object
Dim a As DirectoryEntry = GetComputersInfoCollection ("ioptc.or g")
Dim mySearcher As System.DirectoryServices.D irectorySe archer = _
New System.DirectoryServices.D irectorySe archer(a)
mySearcher.Filter = ("(objectClass=computer)")
Dim resEnt As System.DirectoryServices.S earchResul t
For Each resEnt In mySearcher.FindAll()
Try
TextBox20.Text = TextBox20.text + (":Processing:" & Mid(resEnt.GetDirectoryEnt ry).Name.T oString(), 4))
Catch ex As Exception
Console.WriteLine("Trying to Connect to: " & _
resEnt.GetDirectoryEntry() .Name.ToSt ring() & vbCrLf & ex.Message.ToString())
End Try
Next
and
Public Function GetComputersInfoCollection (ByVal domain As String) As DirectoryEntry
Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain, "ioptc\rpi", "ali ranji 321", AuthenticationTypes.Secure )
domainEntry.Children.Schem aFilter.Ad d("compute r")
Return domainEntry
End Function
but when i run i get this error message:The provider does not support searching and cannot search WinNT://ioptc.org
Dim management_object As ManagementObject
Dim m_local_domain_name As String
Dim m_local_computer_name As String
For Each management_object In queryCollection
m_local_domain_name = management_object("Domain"
m_local_computer_name = management_object("Name")
Next management_object
Dim a As DirectoryEntry = GetComputersInfoCollection
Dim mySearcher As System.DirectoryServices.D
New System.DirectoryServices.D
mySearcher.Filter = ("(objectClass=computer)")
Dim resEnt As System.DirectoryServices.S
For Each resEnt In mySearcher.FindAll()
Try
TextBox20.Text = TextBox20.text + (":Processing:" & Mid(resEnt.GetDirectoryEnt
Catch ex As Exception
Console.WriteLine("Trying to Connect to: " & _
resEnt.GetDirectoryEntry()
End Try
Next
and
Public Function GetComputersInfoCollection
Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain, "ioptc\rpi", "ali ranji 321", AuthenticationTypes.Secure
domainEntry.Children.Schem
Return domainEntry
End Function
but when i run i get this error message:The provider does not support searching and cannot search WinNT://ioptc.org
ASKER
I write
dirEntry.Path = "LDAP://10.48.10.50/CN=Use rs;DC=iopt c"
and I get error :
A referral was returned from the server
please help me
dirEntry.Path = "LDAP://10.48.10.50/CN=Use
and I get error :
A referral was returned from the server
please help me
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I write
dirEntry.Path = "LDAP://ioptc/OU=Users"
ioptc is our company domain and I want to get computername of all clients,
and error occure:
operation error occured
please help me !
what I replace in OU=Users?
that'scorrect?
dirEntry.Path = "LDAP://ioptc/OU=Users"
ioptc is our company domain and I want to get computername of all clients,
and error occure:
operation error occured
please help me !
what I replace in OU=Users?
that'scorrect?
I'd use the full path to the domain
OU=Users,DC=ioptc,DC=com
OU=Users,DC=ioptc,DC=com
ASKER