Remove email domain suffix from distributionlist or group

$Groups = Get-DistributionGroup -Resultsize unlimited | where {$_.EmailAddresses -like “gnsensortech.dk“}

foreach($Group in $groups){

$temp = $Group.Name
$temp2 = ((Get-DistributionGroup $temp).EmailAddresses -like "*gnsensortech.dk") -replace "\w*\:" #Using domain name to find the full address

Set-DistributionGroup $temp -EmailAddresses @{remove=$temp2}

}

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *

Please reload

Vent venligst...