MsgBox "Profile : "&objRecordSet.Fields("Name").Value &vbCrLf &_On Error Resume Next
Dim Username
Username=InputBox("Please Input the Venus User Profile you want to search):","Input User Profile","")
If Username = "" Then
MsgBox "User search 1.0 beta" &vbcrlf & "Copyright: Roger Le"
WScript.Quit
End If
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommandProperties("Sort On") = "Name"
objCommand.CommandText = _
"SELECT Name,displayName,mail FROM 'LDAP://DC=venus,DC=dkcorp,DC=net' WHERE sAMAccountName='"& Username &"'"
Set objRecordSet = objCommand.Execute
If objRecordSet.EOF Then
MsgBox "User Not FOUND!!!"
WScript.Quit
End If
MsgBox "Profile : "&objRecordSet.Fields("Name").Value &vbCrLf &_
"Display : "&objRecordSet.Fields("displayName").Value&vbCrLf &_
"Email : "&objRecordSet.Fields("mail").Value&vbCrLf
WScript.Quit
