Here's a command line script that will output the info in CSV format. 
Simply redirect output to a file to save it.

If this doesn't come through, email me off-list from an account that accepts 
VBS content in an attached text file and I'll send it to you, or post it to 
a website for download.

Hope this helps,

Darin.

'=================================
'Begin Script ListIMailUsersWithPasswords.vbs
'=================================
Main

Sub Main()
  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 users
            oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey & 
"\Users", arrSubKeys3

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

                  StdOut.WriteLine subkey3 & "@" & subkey & "," & 
getPassword(trim(subkey3 & "@" & subkey))

                End If
              Next
            End If

          End If

        Next
      End If

    End If
  Next
End Sub

Function getPassword(emailAddress)

  Dim WshShell, objArgs, domain, username, passwordEncrypted, password
  Dim count, characterU, characterP, asciiU, asciiTotal, asciiP, 
tempnumber1, tempNumber2
  Dim uCount, splitemail

  Set WshShell = WScript.CreateObject("WScript.Shell")

  emailAddress = lcase(trim(emailAddress))
  splitEmail = split(emailAddress,"@")
  username = splitEmail(0)
  domain = splitEmail(1)
  passwordEncrypted = 
WshShell.RegRead("HKLM\Software\IPSwitch\IMail\Domains\" & domain & 
"\Users\" & username & "\Password")

  count = 1
  Ucount = count
  password = ""

  do until (count * 2) > len(passwordEncrypted)
        characterU = right(left(username, Ucount),1)
        characterP = right(left(passwordEncrypted, count * 2), 2)
        tempNumber1 = left(characterP, 1)
        select case left(characterP, 1)
                case "A"
                        tempNumber1 = 10
                case "B"
                        tempNumber1 = 11
                case "C"
                        tempNumber1 = 12
                case "D"
                        tempNumber1 = 13
                case "E"
                        tempNumber1 = 14
                case "F"
                        tempNumber1 = 15
        end select
        tempNumber2 = right(characterP, 1)
        select case right(characterP, 1)
                case "A"
                        tempNumber2 = 10
                case "B"
                        tempNumber2 = 11
                case "C"
                        tempNumber2 = 12
                case "D"
                        tempNumber2 = 13
                case "E"
                        tempNumber2 = 14
                case "F"
                        tempNumber2 = 15
        end select
        asciiTotal = (16 * tempNumber1) + tempNumber2
        asciiU = asc(characterU)
        asciiP = asciiTotal - asciiU
        password = password & chr(asciiP)
        count = count + 1
        if Ucount = len(username) then
                Ucount = 1
        else
                Ucount = Ucount + 1
        end if
  loop
  getPassword = password
End Function

'=================================
' End Script List IMailUsersWithPasswords.vbs
'=================================

----- Original Message ----- 
From: "Jorge Expressmail" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 20, 2008 6:44 PM
Subject: [IMail Forum] Export users and password to ext db


Hi, is there a way to export users and passwords from Imail db to mssql
server

please advise.

Jorge


To Unsubscribe: http://imailserver.com/support/discussion_list/
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://imailserver.com/support/kb.html


To Unsubscribe: http://imailserver.com/support/discussion_list/
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://imailserver.com/support/kb.html

Reply via email to