header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Rename Distribution Groups
Last Post 12 Jun 2008 11:11 AM by Yogi. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
YogiUser is Offline
New Member
New Member
Posts:2

--
11 Jun 2008 01:51 PM  

Hi,

I'm having trouble creating a script, that can change the name, alias, displayname, samaccountname on specific distributions groups. I only have to change the first part of the name on each distribution group from GEN_ to POW_.

Hope someone can help me out, since I'm pretty new to Powershell.

-Yogi

KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
11 Jun 2008 04:04 PM  
Yogi;

This will do what you want.

$groups = Get-DistributionGroup -filter{displayname -like "GEN_*"}
foreach ($group in $groups)
{
    $group.name = $group.name.tostring().replace("GEN","POW")
    $group.displayname = $group.displayname.tostring().replace("GEN","POW")
    $group.alias = $group.alias.tostring().replace("GEN","POW")
    $group.samaccountname = $group.samaccountname.tostring().replace("GEN","POW")
    $group |Set-DistributionGroup
}


Note that I have no error checking at all.

Karl
KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
11 Jun 2008 04:05 PM  
Oh, this is on Exchange 2007 SP1, have not tested it on earlier versions.
YogiUser is Offline
New Member
New Member
Posts:2

--
12 Jun 2008 11:11 AM  

Thanks Karl,

It worked like a charm.

-Yogi

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer