Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Mail enable users from csv and log

$
0
0

Here is what I know:

I have a csv export from groupwise (attached here but only containing an example user)

I have to mail enable thousands of users in exchange 2013 CU2 and the AD objects exist:

1. target mailDB is called 'powerusers'
2. SamAccountName exists in a column in csv.
3. Logging of users not found in AD is a must
4. Logging of users found and email address applied is a must.

I know I can do something like this but i need the logging and target DB:(  Please help.

ForEach ($User in (Import-CSV c:\scripts\mycsv.csv))
{ Enable-Mailbox -Identity $User.SamAccountName
}

Or even one line it:

Import-CSV c:\scripts\mycsv.csv | ForEach { Enabled-Mailbox -Identity $_.SamAccountName }

 

 

csv looks like this:

 

 

SourceAddressTargetAddressDisplayNameGivenNameSurnameNativeObjTypeUseridsamACCOUNTNamePostOfficeDepartmentTitle
wc13846.SD41-PO1.SD41-DOM1Vlodek.Czubak@sd41.bc.caVlodek CzubakVlodekCzubak10wc13846
e13846SD41-PO1MaintenanceElectrician

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles