Link to home
Start Free TrialLog in
Avatar of datacomsmt
datacomsmtFlag for Australia

asked on

Powershell import-csv question

Hi,

I have a CSV file with two columns; the first column is a “mailbox” and the second column is a proposed “MaxSendSize”(i.e each row has a different mailbox name and a different “MaxSendSize” number).

I need a powershell script that can read from this CSV file so that it can set the MaxSendSize for every mailbox on exchange as per this CSV file.

For powershell scriptwriters with no exchange cmdlet knowledge, this is how the maxsendsize id usually set:

Get-mailbox “mailbox from the csv file” | Set-Mailbox –MaxSendSize “from the CSV file on the same raw”
Avatar of Manpreet SIngh Khatra
Manpreet SIngh Khatra
Flag of India image

Try with one or 2 and see if that helps
Import-Csv "name".csv | Set-Mailbox

- Rancy
Found something more so though of sharing

http://www.netometer.com/video/tutorials/how-to-bulk-create-and-modify-users-in-Active-Directory-Exchange-2010-Management-Shell/

## Import data from csv and store it in variable 'data'

$data = import-csv $args[0]

foreach ($i in $data)
{
 $alias = $i.First[0] + $i.Last

 $custom1 = $i.Custom1

 Set-Mailbox -Identity $alias -CustomAttribute1 $custom1
}

- Rancy
Avatar of datacomsmt

ASKER

Hi Rancy,

Thanks for your help, but non of this answers my question...
I believe it should be a 3-4 line script to "read" each mailbox namde, | set the value from the same raw..
Can you try with someone just for testing with a csv for 2 users ?

Import-csv "C:\filename.csv" | foreach {set-mailbox $_.MaxSendSize $_.name}

https://www.experts-exchange.com/questions/26990630/Mulitple-Exchange-2010-Send-Receive-Limits.html
1. Create a CSV file with all the usernames of all users whom you want to change message size - with heading for that column as UName
2. run the below powershell cmdlets

$users = import-csv "<Location of CSV>"
$users | foreach{set-mailbox -identity $_.UName -MaxReceiveSize <Size> -MaxSendSize <Size> -whatif}

- Rancy
ASKER CERTIFIED SOLUTION
Avatar of slidingfox
slidingfox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!