Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script to import users and created mailboxes in Exchange 2007...er

9 views
Skip to first unread message

al

unread,
Nov 14, 2009, 12:35:01 PM11/14/09
to
I have a script that i have written that will import users from a csv file
and create the mailboxes. Here is the code:

# Set up variables

$data = Import-CSV c:\import.csv
# Database where we are going to put the user mailboxes
$mdb = 'EX07SP1\Mailbox Database'
$ou = 'litwareinc.com/Users'

#Import the data and create the new mailboxes

ForEach ($i in $data){
$ss = ConvertTo-SecureString $i.password -asPlaintext -Force
$upn = $i.id + "@ehs.com"
New-Mailbox -Password $ss -Database $mdb -UserPrincipalName $upn -name
$i.fullname -OrganizationalUnit $ou -SamAccountName $i.id -FirstName
$i.firstname -LastName $i.lastname -Displayname $i.fullname
}


When I execute the acript I get the following error:

Cannot bind argument to parameter 'String' because it is null.
At :line:12 char:28
+ $ss = ConvertTo-SecureString <<<< $i.password -asPlaintext -Force

What I would like to do is when I import the users I would like the password
to be the users employee ID #(eight characters) and then they can change it
when they log in with Outlook Web Access. Below is data from the CSV file:

id,FullName,LastName,FirstName,Password
Madams,Mike Adams,Adams,Mike,84953436

Any ideas on how to make this work or what the error might be?

Thanks,
Alex

Marco Shaw [MVP]

unread,
Nov 14, 2009, 6:24:47 PM11/14/09
to
Can we see the first few lines of import.csv? Even if you have to make up
fake values...

Marco

"al" <a...@discussions.microsoft.com> wrote in message
news:2FAC063F-9B4F-47C4...@microsoft.com...

al

unread,
Nov 15, 2009, 11:26:02 AM11/15/09
to
Hi Marco, here it is:

id,FullName,LastName,FirstName,Password
Madams,Mike Adams,Adams,Mike,84953436

This is just one line that a tried to test. I am going to import 1700 users
into my AD/Exchange environment from and ldap extract that goes to a csv for
import. After I solve this password issue I have an another question.

Thanks,
Alex

"Marco Shaw [MVP]" wrote:

> .
>

Marco Shaw [MVP]

unread,
Nov 16, 2009, 11:59:47 AM11/16/09
to
I'll try this maybe tomorrow. It should work from what I can see...

Marco

"al" <a...@discussions.microsoft.com> wrote in message

news:3A5B1D76-9EEB-4728...@microsoft.com...

al

unread,
Nov 17, 2009, 1:08:27 AM11/17/09
to
Thanks Marco! I appreciate your time!

"Marco Shaw [MVP]" wrote:

> .
>

Marco Shaw [MVP]

unread,
Nov 18, 2009, 8:20:20 AM11/18/09
to
I'm still sick from last week... I might try today if my VMs will start up
OK.

"al" <a...@discussions.microsoft.com> wrote in message

news:DB9AF426-8D39-4E1A...@microsoft.com...

al

unread,
Nov 18, 2009, 9:07:01 PM11/18/09
to
Thanks Marco. No worries. Get better first.

Alex

"Marco Shaw [MVP]" wrote:

> .
>

0 new messages