Create Random .CSV data

Posted on 2009-07-16
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 500 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video we show how to create an email address policy 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 Mail Flow…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

626 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