From 2b0003150336192d2c4dad77cdb9323d51141ebd Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 20 Mar 2006 04:06:01 +0000 Subject: * Add small vbscript to export all valid email addresses from a adsi / windows server installation * Update url to point to new script name --- packages/spamd_exchexp.asp | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 packages/spamd_exchexp.asp (limited to 'packages/spamd_exchexp.asp') diff --git a/packages/spamd_exchexp.asp b/packages/spamd_exchexp.asp new file mode 100644 index 00000000..56b0c629 --- /dev/null +++ b/packages/spamd_exchexp.asp @@ -0,0 +1,50 @@ +<% + +dim server +server = "SERVERNAME" + +Sub ExportUsers(oObject) + Dim oUser + For Each oUser in oObject + Select Case oUser.Class + Case "user" + If oUser.mail <> "" then + + for each email in oUser.proxyAddresses + If (lcase(left(email,4))="smtp") Then + 'userFile.WriteLine Mid(email,6) + document.write Mid(email,6) & vbCrLf + End If + next + End if + Case "organizationalUnit" , "container" + If UsersinOU (oUser) then + ExportUsers(oUser) + End if + End select + Next +End Sub + +Function UsersinOU (oObject) + Dim oUser + UsersinOU = False + for Each oUser in oObject + Select Case oUser.Class + Case "organizationalUnit" , "container" + UsersinOU = UsersinOU(oUser) + Case "user" + UsersinOU = True + + End select + Next +End Function + +Dim rootDSE, domainObject +Set rootDSE=GetObject("LDAP://" & server & "/RootDSE") +domainContainer = rootDSE.Get("defaultNamingContext") +Set domainObject = GetObject("LDAP://" & domainContainer) + +ExportUsers(domainObject) +Set oDomain = Nothing + +%> \ No newline at end of file -- cgit v1.2.3