'###Set some variables.### const HKEY_LOCAL_MACHINE = &H80000002 strKeyPath = "Software\Wow6432Node\Ipswitch\IMail\Domains" '##On 32bit systems, this is should be: Software\Ipswitch\IMail\Domains ##" strComputer = "." '##Set to "." for local computer.## '###Call the first Sub, which will start this script.### Main Sub Main() Set StdOut = WScript.StdOut Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") StdOut.WriteLine "Mailbox,Domain,Password,FullName,ApplyQuotas,MaxDiskSpace" '###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 '###Do not migrate the _aliases key or root user.### If subkey3 <> "_aliases" and subkey3 <> "root" Then StdOut.WriteLine """" & subkey3 & """,""" & subkey & """,""" & getPassword(trim(subkey3 & "@" & subkey)) & """,""" & getFullName(trim(subkey3 & "@" & subkey)) & """,1,""" & getMaxSize(trim(subkey3 & "@" & subkey)) & """" End If Next End If End If Next End If End If Next End Sub Function getFullName(FN_emailAddress) Set FN_WshShell = WScript.CreateObject("WScript.Shell") splitUserDomain1= Split(LCase(trim(FN_emailAddress)),"@") username_part1 = splitUserDomain1(0) domain_part1 = splitUserDomain1(1) fullName = FN_WshShell.RegRead("HKLM\"&strKeyPath&"\" & domain_part1 & "\Users\" & username_part1 & "\FullName") Set FN_WshShell = Nothing getFullName = fullName End Function Function getMaxSize(MS_emailAddress) Set MS_WshShell = WScript.CreateObject("WScript.Shell") splitUserDomain2= split(LCase(trim(MS_emailAddress)),"@") username_part2 = splitUserDomain2(0) domain_part2 = splitUserDomain2(1) maxsize = MS_WshShell.RegRead("HKLM\" &strKeyPath& "\" & domain_part2 & "\Users\" & username_part2 & "\MaxSize") If (maxsize>0) Then maxsize = Round(maxsize/1024) Else maxsize = "-1" End If Set MS_WshShell = Nothing getMaxSize = maxsize End Function 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\" &strKeyPath& "\" & 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