We help IT Professionals succeed at work.

bulk modify displayname property on distribution groups in Exchange Management Shell

adkwinadmin
adkwinadmin used Ask the Experts™
on
I am wanting to change the displayname (and only the displayname) of all my distribution groups in Exchange 2007 but don't want to do it by hand.

For instance we currently have a distribution group named "sales" and I want to prepend and @ and a space to create "@ sales" for the displayname.  I don't want to change anything about the displayname, other than prepending the additional charachters.  

If any powershell/ Exchange Managment Shell scripting guru could help, that would be great.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Solutions Architect
Commented:
try the following

foreach ($g in Get-DistributionGroup)  { $disp = "@ " + $g.DisplayName; Set-DistributionGroup $g -DisplayName $disp}

Author

Commented:
Fantastic! Thank you.

Author

Commented:
and what if a person wanted to do that but for only distributiongroups with a customattribute10 -eq 50 ?
AkhaterSolutions Architect

Commented:
maybe something like

$grp = Get-DistributionGroup | ? { $_.CustomAttribute10  -eq "50"}

foreach ($g in $grp)  { $disp = "@ " + $g.DisplayName; Set-DistributionGroup $g -DisplayName $disp}