open(CSV,">import.csv"); #open file to import to Exchange # write the CSV header my $lineCSV = "Obj-Class,Mode,First Name,Last Name,Display Name,"; $lineCSV .= "Alias Name, Directory Name,Primary Windows NT Account,"; $lineCSV .= "Home-Server,Hide From AB,Alternate recipient,"; $lineCSV .= "Deliver to both,E-mail address\n"; # write the data we want to import $lineCSV .= "MAILBOX,UPDATE," . $firstname . "," . $lastname . ","; $lineCSV .= "\"" . $fullname . "\"," . $username . "," . $username . ","; $lineCSV .= "domain\\" . $username . ",MAILSERVER"; $lineCSV .= "0,,,"; #print it to CSV and close it print CSV $lineCSV; close(CSV); # run the commandline import with specified options my $exchCommand = "c:\\exchsrvr\\bin\\admin.exe /i import.csv "; $exchCommand .= "/d " . $refRS->Fields("mailServer")->value; $exchCommand .= " /n /o options.txt"; my $exchOut = `$exchCommand`;