aboutsummaryrefslogtreecommitdiffstats
path: root/packages/spamd_exchexp.asp
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-03-20 04:06:01 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-03-20 04:06:01 +0000
commit2b0003150336192d2c4dad77cdb9323d51141ebd (patch)
treec599b62c8961c340b9faf80c11f1e7b7d7e587fa /packages/spamd_exchexp.asp
parent7bf1bb01833503664ae430814284ece388a3540a (diff)
downloadpfsense-packages-2b0003150336192d2c4dad77cdb9323d51141ebd.tar.gz
pfsense-packages-2b0003150336192d2c4dad77cdb9323d51141ebd.tar.bz2
pfsense-packages-2b0003150336192d2c4dad77cdb9323d51141ebd.zip
* Add small vbscript to export all valid email addresses from a adsi / windows server installation
* Update url to point to new script name
Diffstat (limited to 'packages/spamd_exchexp.asp')
-rw-r--r--packages/spamd_exchexp.asp50
1 files changed, 50 insertions, 0 deletions
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