Japtastic Posted September 11, 2014 Posted September 11, 2014 (edited) Has any one got a script that can achieve this from a CSV file? Cheers Edited September 11, 2014 by Japtastic
Marshall_IT Posted September 11, 2014 Posted September 11, 2014 (edited) I'd probably just use excel to create 160 lines of code in powershell but that's maybe lazy. I'll have a quick look. Edited September 11, 2014 by Marshall_IT
Marshall_IT Posted September 11, 2014 Posted September 11, 2014 Are all addresses on the same line? Or are they all on separate lines?
Marshall_IT Posted September 11, 2014 Posted September 11, 2014 $Email_Array = (Get-Content test2.csv)[0] foreach ( $Email in $Email_Array){ Set-Mailbox "Dan Jump" -EmailAddresses @{add="$Email"} } I can't test it but I think that should work if all the emails are on separate lines. If not you can add .split(",") to the end of the first line. I do all my email management on office 365 which is exchange online 2013 but this should still work.
DMcCoy Posted September 11, 2014 Posted September 11, 2014 Someone has a lot of ipads! (just a guess)
Japtastic Posted September 11, 2014 Author Posted September 11, 2014 Thanks, I'll try it out. Next problem, I can get Excel to produce ipad1 -> ipad164 but as soon as I add the full email address it wont do it. It pastes ipad1,2,3,4 ipad1,2,3,4 Can you tell I don't use Excel! You guessed right! Such a joy trying to get them configured and deployed!
DMcCoy Posted September 11, 2014 Posted September 11, 2014 If you just want a long list of commands you can use text columns with concatenate function to build a string fairly easily, then copy and paste as text into notepad. Used to do that for various things when it was quicker than working out and testing a loop
Arthur Posted September 11, 2014 Posted September 11, 2014 Has anyone got a script that can achieve this from a CSV file? The following script should do what you want without a CSV file. 1..160 | ForEach { Set-Mailbox Japtastic -EmailAddresses @{Add="[email protected]"} } 1
Marshall_IT Posted September 11, 2014 Posted September 11, 2014 @Arthur has got the nail on the head here and removed the complexity. 1
Japtastic Posted September 16, 2014 Author Posted September 16, 2014 Spot on, many thanks to both of you. That saved me a lot of time!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now