Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Create Random .CSV data

Posted on 2009-07-16
Medium Priority
Last Modified: 2013-11-15
Hi Experts,

I have a strange request. I am building a test Exchange 2007 environment and I want to manage large numbers of accounts. Does anyone know of any template .CSV files I can download that contain user names and email addresses that I can import into Exchange?
I would like to have hundreds or even thousands of accounts. Otherwise is there a way to generate this data through Excel or via scripts?

Thanks in advance
Question by:nealerocks
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 27

Accepted Solution

shauncroucher earned 2000 total points
ID: 24872887

I have a CSV I created whilst testing bulk management using powershell.

Attached is the CSV. Put this in same directory where you run the following command and it will create a whole load of unique users (250 for this CSV) and puts them in the Mailbox Database called 'Mailbox Database' (change this if yours is different). Organisational Unit Users (change if you prefer somewhere else).  

I used Excel to create the CSV.

Import-Csv recipients.csv | foreach { $Password = ConvertTo-SecureString $_.password -asplaintext -force;$UPN = $_.UPN+$_.Domain; New-Mailbox alias $_.Alias name $_.Name -FirstName $_.FirstName -LastName $_.LastName UserPrincipalName $UPN Database mailbox database OrganizationalUnit Users Password $Password}

LVL 27

Expert Comment

ID: 24872908
Posting that changed hyphen to !!
I'll try that again.


Import-Csv recipients.csv | foreach { $Password = ConvertTo-SecureString $_.password -asplaintext -force;$UPN = $_.UPN+$_.Domain; New-Mailbox alias $_.Alias name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $UPN Database mailbox database -OrganizationalUnit Users -Password $Password}

LVL 27

Expert Comment

ID: 24872924
I don't know why hyphens are being turned into double exclamation marks here. Sorry.

One more go:

Import-Csv recipients.csv | foreach { $Password = ConvertTo-SecureString $_.password -asplaintext -force;$UPN = $_.UPN+$_.Domain; New-Mailbox -alias $_.Alias -name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $UPN -Database mailbox database -OrganizationalUnit Users -Password $Password}

LVL 27

Expert Comment

ID: 24872946
Right, I haven't attached code on here before except simple Powershell commands.

This is the full command you need with the CSV. Ignore all others.

Import-Csv recipients.csv | foreach { $Password = ConvertTo-SecureString $_.password -asplaintext -force;$UPN = $_.UPN+$_.Domain; New-Mailbox -alias $_.Alias -name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $UPN -Database "mailbox database" -OrganizationalUnit Users -Password $Password}

Open in new window

LVL 12

Author Closing Comment

ID: 31604351
Thats awesome thanks!!!

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New style of hardware planning for Microsoft Exchange server.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question