isaacviruet
(Warp3dL0gic)
1
Hello everyone,
I wondering if i could get some help with Exchange. Im trying to see if a powershell can export a list of all emails in order. in our exhange we have multiple addresses and they want to put them all in their distrobution groups.
Example of what I’m trying to do:
User1@example.org | User1@example2.org | User1@example3.org
User2@example.org | User2@example2.org | User2@example3.org
User3@example.org | User2@example2.org | User3@example3.org
So we’re trying to see if powershell can export a list like this so that we can put everyone thats in @example1 in the example1 distro group in Exhange. same for the other distribution groups.
we have a approximately 6 distribution groups that we need to get everyone in so the next thing would getting all those addresses in their distribution groups.
My apologies if i sound like a moron, I’m new to this.
3 Spice ups
Neally
(Neally)
2
So are those different domains, or aliases, or contacts?
maybe something like this:
get-mailbox -resultsize unlimited | select -expand emailaddresses alias
jitensh
(JitenSh)
3
if you have Psv3 its going to work
function Transpose-Data{
param(
[String[]]$Names,
[Object[][]]$Data
)
for($i = 0;; ++$i){
$Props = [ordered]@{}
for($j = 0; $j -lt $Data.Length; ++$j){
if($i -lt $Data[$j].Length){
$Props.Add($Names[$j], $Data[$j][$i])
}
}
if(!$Props.get_Count()){
break
}
[PSCustomObject]$Props
}
}
$Lista = @(get-mailbox -resultsize unlimited |?{$_.primarysmtpaddress -like '*@example1.com'}|select -exp primarysmtpaddress)
$ListB = @(get-mailbox -resultsize unlimited |?{$_.primarysmtpaddress -like '*@example2.com'}|select -exp primarysmtpaddress)
$listC= @(get-mailbox -resultsize unlimited |?{$_.primarysmtpaddress -like '*@example3.com'}|select -exp primarysmtpaddress)
Transpose-Data EmailaddressA, EmailaddressB,EmailaddressC $Lista, $ListB,$listC |export-csv c:\emails.csv
1 Spice up
you guys are always saving me. I’m going to have to get you two a Christmas present.
jitensh
(JitenSh)
5
Please mark answer as best answer so that it helps others