Thanks I checked the page. Well it is quite helpful.
While I wrote this script for my environment. Hope this post could help some one else too.
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1
'
' NAME:
'
' AUTHOR: Ashish Tiwari , Hewlett-Packard Company
' DATE : 8/3/2009
'
' COMMENT:
'
'==========================================================================
Option Explicit
Dim objfso, dclist, result, objserver, objPing, strServerName, objStatus, strline
Set objFSO = CreateObject("scripting.filesystemobject")
Set dclist = objfso.OpenTextFile("dclist.txt")
If objfso.FileExists("result.txt") Then
objfso.DeleteFile("result.txt")
Set result = objfso.CreateTextFile("result.txt")
Else
Set result = objfso.CreateTextFile("result.txt")
End If
strline = ""
Do
strServerName = dclist.ReadLine
strServerName = Trim(strServerName)
result.WriteLine strline
strline = strServerName & ","
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select Replysize from Win32_PingStatus where address = '" & strServerName & "'")
For Each objStatus in objPing
If IsNull(objStatus.ReplySize) Then
'/ If not reacheable Log the computer name in Log File.
strline = strline & "NotReacheable"
Else
'/ If the server is reachable then
On Error Resume Next
Set objserver = GetObject("LDAP://" & strServerName & ":636")
If Not objServer = Null Then
'/ If connection fails at port 636 via LDAP portocol
strline = strline & "Success"
Else
'/ If connection is successful at port 636 via LDAP portocol
strline = strline & "Failure"
End If
End If
Next
Loop Until dclist.AtEndOfStream
result.WriteLine strline
Set dclist = Nothing
Set result = Nothing
Set objFSO = Nothing
WScript.Echo "Check result.txt file in current folder."