Thanks to Paul! I came up with the following.

code:

break on cls
;----------------------------------------------------------------------------------------------
; This script will pull the userid and smtp address from an exchange server and create a ini
; databse file.
;
; This script must be ran on the exchange server, under a useraccount that has exchange admin
; rights.
;
; IF an Useraccount is found that has more than 1 SMTP address, you will be prompted to choose
; what SMTP address to use.
;----------------------------------------------------------------------------------------------

$orgname = "<orgname>" ;your mail orginization name
$sitename = "<sitename>" ;your mail site name
$ExchangeServer = "@wksta" ;your mail server name
$domain = "@domain" ;your domain name


$database = "\\server\c$\email.ini" ;the name of the ini databse file
$DBName = "EMAIL"


$cr = chr(13)+chr(10)
$options = "%temp%\export.tmp"
$dumpfile = "%temp%\dumpfile.tmp"
$tempfile = "%temp%\temp.tmp"
;----------------------------------------------------------------------------------------------

$options_txt = '[Export]'+$cr+'Subcontainers=Yes'+$cr+'Basepoint=/o=$orgname/ou=$sitename'
$exchadminpath = readvalue("HKEY_LOCAL_MACHINE\Software\Microsoft\Exchange\Setup","AdminDest")

if exist($options) = 1 del "$options" endif
if exist($dumpfile) = 1 del "$dumpfile" endif

$nul = open(1,$options,5) $nul = writeline(1,$options_txt) $nul = close(1)

? "Dumping GAL from $ExchangeServer..."
shell '$exchadminpath\admin.exe /e $tempfile /d $Exchangeserver /o $options'
? "Filtering GAL for SMTP addresses only"
shell '%comspec% /c type "$tempfile" | find /i "SMTP:" > "$dumpfile"'

del "$tempfile" del "$options"

$nul = open(1,$dumpfile,2)
$line = readline(1)

? "Initializing the database..."
$nul = writeprofilestring($database,$dbname,"","")
do
$line = substr($line,instr($line,$domain)+len($domain)+1,len($line))
$userid = substr($line,1,instr($line,",")-1)
$line = substr($line,instr($line,"SMTP:")+ len("SMTP:"),len($line))
$smtp = substr($line,1,instr($line,"%%")-1)

select
case $userid <> ""
select
case readprofilestring($database,$DBName,$userid) <> ""
? "$userid has multi SMTP address: please pick 1 to use"
? "(A)$smtp (B)" readprofilestring($database,$DBName,$userid)
:AB
get $AB
select
case $ab = "A"
$nul = writeprofilestring($database,$DBNAME,$userid,$smtp)
case $ab = "B"
; do nothing
case 1
beep goto AB
endselect
?
case 1
$nul = writeprofilestring($database,$dbname,$userid,$smtp)
endselect
case 1
? "Dead account---"
? $smtp ?
endselect
$line = readline(1)
until @error <> 0

$nul = close(1)
del $dumpfile