Hello,

for  anybody,  who  likes to test ASSP, I just created some scripts to
export  Users  and  Domains for ASSP. It is designed to work only with
virtual Domains.
Works great for us with 230+ Domains and aprox 1000 Users.

They  are  quick  and  dirty and "compiled" from the scripts mentioned
here some times ago.
I run the batch in a scedule to sync imail with assp.

a) imail-adresses.vbs
Prints  out   all   valid   email   Adresse  for  all  Domains, Users,
Domain- and User-Aliases
------------------------------------------------------------

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &strComputer 
& "\root\default:StdRegProv")

strKeyPath = "Software\Ipswitch\IMail\Domains"

' List the Domain keys
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
  If left(subkey,8) <> "$virtual" Then


    ' Find the domains keys with a Users key
    oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, arrSubKeys2

    If not isnull(arrSubKeys2) Then
      For Each subkey2 In arrSubKeys2

        If subkey2 = "Users" Then

         

          ' List the aliases
          oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey 
&"\Users\_aliases", arrValueNames, arrValueTypes

          If not isnull(arrValueNames) Then
            nobody=0
            For i = 0 to UBound(arrValueNames)
               if arrValueNames(i)="nobody" then nobody=1
            next

            For i = 0 to UBound(arrValueNames)

                oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" 
&subkey & "\Users\_aliases", arrValueNames(i), strValue
                oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" 
&subkey , "Address", address
                
                strValueName = "Aliases"                
                oReg.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" 
&address , strValueName, arrValues


                if arrValueNames(i)<>"nobody" then
                        if nobody=0 then StdOut.writeline arrValueNames(i)& "@" 
& subkey
                else
                        StdOut.WriteLine "@" & subkey
                end if

                If not isnull(arrValues) Then
                For each alias in arrValues
                if arrValueNames(i)<>"nobody" then
                        if nobody=0 then StdOut.writeline 
arrValueNames(i)&"@"&alias 
                else
                        StdOut.WriteLine "@" & alias
                end if

              
                Next
                End If
                
            Next
          End If
                ' List the users
          oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey &"\Users", 
arrSubKeys3

          If not isnull(arrsubkeys3) Then
            For each subkey3 in arrSubKeys3
              If subkey3 <> "_aliases" Then

                if nobody=0 then StdOut.WriteLine subkey3 & "@" & subkey
                If not isnull(arrValues) Then

                        For each alias in arrValues
                        if nobody=0 then StdOut.writeline subkey3 &"@"&alias 
                        next
                End If
               End if
            Next
          End If

        End If

      Next
    End If

  End If
Next
StdOut.writeline "root"
StdOut.writeline "postmaster"
------------------------------





b) imail-domains.vbs
Prints all Local Domains/Domainaliases:
------------------------------

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &strComputer 
& "\root\default:StdRegProv")

strKeyPath = "Software\Ipswitch\IMail\Domains"

' List the Domain keys
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
  If left(subkey,8) = "$virtual" Then

    strValueName = "Official"
    oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" &subkey , 
strValueName, strValue
   
        StdOut.WriteLine strValue

    strValueName = "Aliases"
    oReg.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" &subkey , 
strValueName, arrValues
    For Each strValue In arrValues
        StdOut.WriteLine  strValue
    Next
   end if
    
Next

' Put the Domainaliases and domain of your Local Host here:
StdOut.WriteLine "mail.internethit.de"
StdOut.WriteLine "haack-it.de"
StdOut.WriteLine "haack-it.at"

-------------------------------------



c) domains.bat
a batchfile wich combines everything:
-------------------------------------

cscript imail-adresses.vbs //NoLogo > h:\assp\users.txt
cscript imail-domains.vbs //NoLogo > h:\assp\domains.txt

-------------------------------------


Greetings
         Matti
         


- 
Matti Haack - Hit Haack IT Service Gmbh
Poltlbauer Weg 4, D-94036 Passau
+49 851 50477-22 Fax: +49 851 50477-29
http://www.haack-it.de



Dieses Dokument ist ausschliesslich fuer den Adressaten bestimmt.
Jegliche Art von Reproduktion, Verbreitung, Vervielfaeltigung, Modifikation, 
Verteilung und/oder Publikation dieser E-Mail-Nachricht ist untersagt, 
soweit dies nicht  ausdruecklich genehmigt wurde. Jegliche Haftung fur 
Ansprueche,  die aufgrund der Kommunikation per E-Mail begruendet 
werden koennten, ist ausgeschlossen, soweit der Haftungsausschluss 
gesetzlich zulaessig ist.  

-- Ausgehende E-Mail wurde auf Viren gescannt  --
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to