Ok, es ist so nicht, aber ...VBS String wizzardry
so ist dies eine schnelle Skript I found on the internet, die auf meinem Exchange-Server läuft und Dumps eine Liste von E-Mail-Adressen, die ich für die Empfängerüberprüfung auf einer Spam verwenden kann Filter:
' Export all valid recipients (= proxyAddresses) into a
' file virtual.txt
'
' Ferdinand Hoffmann & Patrick Koetter
' 20021100901
' Shamelessly stolen from
' http://www.microsoft.com/windows2000/techinfo/ \
' planning/activedirectory/bulksteps.asp
'Global variables
Dim Container
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("virtual.txt", True)
Set Container=GetObject("LDAP://CN=Users,DC=office,DC=example,DC=com")
'Enumerate Container
EnumerateUsers Container
'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set Container = Nothing
'Say Finished when your done
WScript.Echo "Finished"
WScript.Quit(0)
'List all Users
Sub EnumerateUsers(Cont)
Dim User
'Go through all Users and select them
For Each User In Cont
Select Case LCase(User.Class)
'If you find Users
Case "user"
'Select all proxyAddresses
Dim Alias
If Not IsEmpty(User.proxyAddresses) Then
For Each Alias in User.proxyAddresses
OutPutFile.WriteLine "alias: " & Alias
'WScript.Echo Alias
Next
End If
Case "organizationalunit" , "container"
EnumerateUsers User
End Select
Next
End Sub
der Haken ist, dass die Liste der Empfänger wie diese kommt zurück:
smtp:[email protected]
SMTP:[email protected]
x400:c=US;a= ;p=local;o=Exchange;s=lastname;g=firstname;
smtp:[email protected]
smtp:[email protected]
der Spam-Filter ein Import scrip hat, die nur Zeilen mit „smt importiert p "oder" SMTP "vorangestellt, so dass das x400 kein Problem ist. Ein Problem ist, dass ich nicht möchte, dass VBscript die Adresse "[email protected]" exportiert. Ich habe es versucht:
'List all Users
Sub EnumerateUsers(Cont)
Dim User
'Go through all Users and select them
For Each User In Cont
Select Case LCase(User.Class)
'If you find Users
Case "user"
'Select all proxyAddresses
Dim Alias
If Not IsEmpty(User.proxyAddresses) Then
For Each Alias in User.proxyAddresses
If Not Alias = "*.lan" Then
OutPutFile.WriteLine "alias: " & Alias
WScript.Echo Alias
End If
Next
End If
Case "organizationalunit" , "container"
EnumerateUsers User
End Select
Next
End Sub
Aber das tut nichts. Ich habe versucht, für die public domain (Wenn Alias = "publicdomain" Dann) aber das ergab keine Ergebnisse.
Also, wie filtere ich die Ausgabe, so dass ich nur Adressen auf der Public Domain bekomme?