Bulk enable-mailuser
Hi ,
I'm trying to bulk mail enable a group of users belonging to several OU but I'm having problem with Exchange management shell
The command I'm trying to use is get-user | enable-mailuser .
My problem is that I did not find a way to pass the external amil address I want to assign to each user .
I wish to create an external address in the form InitialFirstName.Lastname@domain.com
I've tried the following
get-user -OrganizationalUnit "TESTEXCH" -recipienttypedetails user | enable-MailUser -ExternalEmailAddress smtp_.FirstName@domain.com
but it fails .
Essentially I failed to find a way to pass the $_ variabile ( or someting similar ) as the left part of the -externalEmail address
Can Anyone help me ?
Thanks
April 7th, 2008 5:59pm
You might want to try creating an array of users:
$users = Get-User -OrganizationalUnit "TESTEXCH" -RecipientTypeDetails user
Then run a foreach to generate an email variable and mail-enable the user:
ForEach($u in $users) {
$mail = "SMTP:"
$mail += $u.FirstName #(or $u.givenName)
$mail += "@domain.com"
Enable-MailUser $u -ExternalEmailAddress $mail
}
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2008 4:43am
For Initial First Name & Last Name in external SMTP address, you can edit the below line into Jim's code.
$mail += $u.FirstName.substring(0,1) #(or $u.givenName.substring(0,1))
$mail += "."
$mail += $u.LastName
April 8th, 2008 5:44am
thanks to all for the help , it worked fine
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2008 10:07am