• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

Create Random .CSV data

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
0
nealerocks
Asked:
nealerocks
  • 4
1 Solution
 
shauncroucherCommented:
Hi,

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}


recipients.csv
0
 
shauncroucherCommented:
Posting that changed hyphen to !!
I'll try that again.

Command:

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}

0
 
shauncroucherCommented:
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}

0
 
shauncroucherCommented:
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.

Shaun
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

0
 
nealerocksAuthor Commented:
Thats awesome thanks!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now