Question Locked

Need script to check LDAPS

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have 110 Domain controllers in my environment. The Platform consists of Windows 2003 Server SP2,Windows 2003 Server x64 SP2, Windows Server 2008.
All the servers are supposed to have certificate installed on them and running on LDAPS.

I need a script which could connect on every server at port636, verify that server is running LDAPS and also connect to its cert store and get the Certificate expiry date.

Guys Please help me with this.

3 replies

by ashish27071977

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."

This discussion is closed to new replies.