cmiadmin
asked on
Exchange 2010 create mail enabled users from a csv file
Hi
I need to create some New mail enabled users (Not new users with Mailboxes) in Exchange 2010.
I can find plenty of articles telling me how to create new users with mailboxes via Powershell but I just need to create mail enabled users. All these users have email addresses external to our company but need to be given AD logons to our Domain.
I have a CSV file containg the users full names, alias, email address, phone number, job title and manager and would like to import as much of this information as possible. but at a minimum, First name, Last name, alias and email address.
Can someone please point me in the right direction.
I need to create some New mail enabled users (Not new users with Mailboxes) in Exchange 2010.
I can find plenty of articles telling me how to create new users with mailboxes via Powershell but I just need to create mail enabled users. All these users have email addresses external to our company but need to be given AD logons to our Domain.
I have a CSV file containg the users full names, alias, email address, phone number, job title and manager and would like to import as much of this information as possible. but at a minimum, First name, Last name, alias and email address.
Can someone please point me in the right direction.
you would be looking for new-mailuser
sorry i forgot to give you the link http://technet.microsoft.com/en-us/library/aa996335.aspx
ASKER
Hi Thank you for the link. But how do I get the script to look at the csv file for the information that needs to be imported?
build your csv something like
Alias,Name,UPN,Password,em ail
User_One,User One,userone@yourUPNsuffix. com,P@ssw0 rd1,useron e@domain1. com
User_Two,User Two,usertwo@yourUPNsuffix. com,P@ssw0 rd2,usertw o@domain2. com
User_Three,User Three,userthree@yourUPNsuf fix.com,P@ ssw0rd3,us erthree@do main3.com
Import-CSV c:\list.csv | foreach {New-mailuser -Alias $_.alias -Name $_.name -UserPrincipalName $_.UPN -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -ExternalEmailAddress $_.email -OrganizationalUnit domain.com/users}
Alias,Name,UPN,Password,em
User_One,User One,userone@yourUPNsuffix.
User_Two,User Two,usertwo@yourUPNsuffix.
User_Three,User Three,userthree@yourUPNsuf
Import-CSV c:\list.csv | foreach {New-mailuser -Alias $_.alias -Name $_.name -UserPrincipalName $_.UPN -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -ExternalEmailAddress $_.email -OrganizationalUnit domain.com/users}
ASKER
Hi
Thank you for this information. In my .csv file I also have office telephone number, Mobile phone number, Company, Job Title and Manager. Would you know how I could incorporate these at the same time?
On a slightly different scenario.
If the users already exist in Acive Directory (Server 2003). Could you mail enable them via a script and .csv file? If so how?
Thank you for this information. In my .csv file I also have office telephone number, Mobile phone number, Company, Job Title and Manager. Would you know how I could incorporate these at the same time?
On a slightly different scenario.
If the users already exist in Acive Directory (Server 2003). Could you mail enable them via a script and .csv file? If so how?
No for the extra information it won't work with new-mailuser you will need to create a user using new-aduser
Import-CSV c:\list.csv | foreach {New-ADUser -Name $_.name -UserPrincipalName $_.UPN -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -OrganizationalUnit domain.com/users -OfficePhone $_.OfficePhone -Company $_.company -Manager $_.manager}
for all properties check http://technet.microsoft.com/en-us/library/ee617253.aspx
then run
Import-CSV c:\list.csv | foreach { Enable-Mailuser $_.UPN -Alias $_.Alias -ExternalEmailAddress $_.email}
this last one will also apply to your second scenario so basically we created first enabled later
Import-CSV c:\list.csv | foreach {New-ADUser -Name $_.name -UserPrincipalName $_.UPN -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -OrganizationalUnit domain.com/users -OfficePhone $_.OfficePhone -Company $_.company -Manager $_.manager}
for all properties check http://technet.microsoft.com/en-us/library/ee617253.aspx
then run
Import-CSV c:\list.csv | foreach { Enable-Mailuser $_.UPN -Alias $_.Alias -ExternalEmailAddress $_.email}
this last one will also apply to your second scenario so basically we created first enabled later
ASKER
Hi
I have done a test import using just Alias,Name,UPN,Password,em ail which has worked well.
However Name obvioulsly gives me "Display Name" in Active Directory. What parameters do I need to get Firstname and Lastname?
If anyone can also help on the other quetions I have above.as well I would appreciate it.
Kevan
I have done a test import using just Alias,Name,UPN,Password,em
However Name obvioulsly gives me "Display Name" in Active Directory. What parameters do I need to get Firstname and Lastname?
If anyone can also help on the other quetions I have above.as well I would appreciate it.
Kevan
Check the link I gave you ! -GivenName and -Surname
what other quesitons ?
what other quesitons ?
ASKER
Hi Thank you. I think my last question crossed with your response in the ether!!
Just giving it all a try now.
Just giving it all a try now.
ASKER
Hi
I am getting the error below when trying to run the New-ADUser command. I am running this on the Exchange 2010 sp1 server in the Exchange Management shell. We are still in a Windows 2003 domain. What am I doing wrong? Would this command only work if I was in a Windows 2008 Domain?
The term 'New-ADUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:62
+ Import-csv "c:\wrcuserswithoutemail.c sv"| foreach {New-ADUser <<<< -GivenName $_.First -Surname $_.Lastname -alias $
_.alias -name $_.name -userPrincipalName $_.UPN -Org $_.organizationalunit -OfficePhone $_.OfficePhone -MobilePhone $_
.Mobile -Company $_.company -Office $_.office -title $_.JobTitle -Password (ConvertTo-SecureString $_.Password -AsPlain
Text -Force) }
+ CategoryInfo : ObjectNotFound: (New-ADUser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
REgards
Kevan
I am getting the error below when trying to run the New-ADUser command. I am running this on the Exchange 2010 sp1 server in the Exchange Management shell. We are still in a Windows 2003 domain. What am I doing wrong? Would this command only work if I was in a Windows 2008 Domain?
The term 'New-ADUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:62
+ Import-csv "c:\wrcuserswithoutemail.c
_.alias -name $_.name -userPrincipalName $_.UPN -Org $_.organizationalunit -OfficePhone $_.OfficePhone -MobilePhone $_
.Mobile -Company $_.company -Office $_.office -title $_.JobTitle -Password (ConvertTo-SecureString $_.Password -AsPlain
Text -Force) }
+ CategoryInfo : ObjectNotFound: (New-ADUser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
REgards
Kevan
yea sorry you need to do an import-module activedirectory before
ASKER
How do I do that?
just from exchange management shell type
Import-Module ActiveDirectory
Import-Module ActiveDirectory
ASKER
Sorry- More problems. I get the error message below when running Import-Module ActiveDirectory
[PS] C:\Windows\system32>import -module ActiveDirectory
WARNING: Error initializing default drive: 'Unable to find a default server with Active Directory Web Services
running.'.
[PS] C:\Windows\system32>
[PS] C:\Windows\system32>import
WARNING: Error initializing default drive: 'Unable to find a default server with Active Directory Web Services
running.'.
[PS] C:\Windows\system32>
you don't have any 2008R2 domain contorller ?
ASKER
No. I have said all along we are running a Windows 2003 Domain.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternatively you can use quest tools and user the New-QADUser http://wiki.powergui.org/index.php/New-QADUser
ASKER
Hi
I have imported the users using our AD Manager Plus to our Domain and then Mail Enabled them using
Import-CSV c:\list.csv | foreach { Enable-Mailuser $_.UPN -Alias $_.Alias -ExternalEmailAddress $_.email}
from the Exchange Server.
Thank you very much for all your help. Hopefully we will have a Windows 2008 R2 Domain soon so as we can fully utilize Power Shell.
I have imported the users using our AD Manager Plus to our Domain and then Mail Enabled them using
Import-CSV c:\list.csv | foreach { Enable-Mailuser $_.UPN -Alias $_.Alias -ExternalEmailAddress $_.email}
from the Exchange Server.
Thank you very much for all your help. Hopefully we will have a Windows 2008 R2 Domain soon so as we can fully utilize Power Shell.
ASKER
Thank you for all your help. I have learnt a lot.
thank you for the point and sorry I wasn't of big help
ASKER
Hi
I thought I had got thie resolved.
I am trying to run this command to mail enable the users that I have already set up.
Import-csv "c:\wrcusersemail.csv"| foreach {Enable-mailuser -userPrincipalName $_.UPN -alias $_.Alias -ExternalEmailAddress $_.email}
However I get this error:
A positional parameter cannot be found that accepts argument 'SEdwards@oxford.nsf.org'.
+ CategoryInfo : InvalidArgument: (:) [Enable-MailUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFoun d,Enable-M ailUser
Can you tell me why?
Thank you.
Kevan
I thought I had got thie resolved.
I am trying to run this command to mail enable the users that I have already set up.
Import-csv "c:\wrcusersemail.csv"| foreach {Enable-mailuser -userPrincipalName $_.UPN -alias $_.Alias -ExternalEmailAddress $_.email}
However I get this error:
A positional parameter cannot be found that accepts argument 'SEdwards@oxford.nsf.org'.
+ CategoryInfo : InvalidArgument: (:) [Enable-MailUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFoun
Can you tell me why?
Thank you.
Kevan
ASKER
Hi I have sorted this out.
I used:
import-csv "c:\wrcusersemail.csv"| foreach {Enable-mailuser -Identity $_.Identity -alias $_.Alias -ExternalEmailAddress $_.email}
And created a field for -identity in my csv file.
For info for other users this looked like this
child.domain.org/OU/OU/Use rs name as below.
'uk.nss.org/london-Users/W RC/Alan Smith'
I used:
import-csv "c:\wrcusersemail.csv"| foreach {Enable-mailuser -Identity $_.Identity -alias $_.Alias -ExternalEmailAddress $_.email}
And created a field for -identity in my csv file.
For info for other users this looked like this
child.domain.org/OU/OU/Use
'uk.nss.org/london-Users/W