Solved

Script needed to Search AD for specific Server listed as Expansion Server for Dist Lists and then change it

Posted on 2010-09-06
4
686 Views
Last Modified: 2012-05-10
Hi All

We are about to Decomission an Exchange server however it has a large number of Distribution list that it is listed as the expansion server for, I need a script that will search AD for Distribution lists that have this server (EXCHSVR05) listed as there Expansion server and then Change it to (EXCHSVR07)

Thanks

0
Comment
Question by:ncomper
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:DavidGerald
ID: 33609924
Hi

Code from:
http://www.technogist.com/tag/ad/
Searching for DL's with Exchange Expansion Servers



You will need Quest Active Roles, its free and quick to install.
Get-QADGroup -SearchRoot 'OU=GrouOU,DC=company,DC=com' -SizeLimit 0 -LdapFilter '(msExchExpansionServerName=*)' -IncludeAllProperties | Select-Object name,msexchexpansionservername,managedby

Open in new window

0
 
LVL 5

Author Comment

by:ncomper
ID: 33609979
Hi David

Thanks for the reply, so looking at your example would my script be the below

Get-QADGroup -SearchRoot 'OU=Exchange,DC=company,DC=com' -SizeLimit 0 -LdapFilter '(msExchExpansionServerName=EXCHSVR05)' -IncludeAllProperties | Select-Object name,msexchexpansionservername,managedby EXCHSVR07

or have i put my source and Target server in the script incorectly.

Thanks
0
 
LVL 2

Accepted Solution

by:
DavidGerald earned 500 total points
ID: 33610101
Oh I see you are not just searching but editing the attribute as well.  I didn't read the question properly.

Bit more complex and without working it out on a lab I can't be sure, my powershell scripting is still pretty basic.


This is probably completely wrong but I think it embodies the concept, this might require someone with more time on powershell, if no one else joins in and you can't find the answer I will take a look on a lab server




Get-QADGroup -SearchRoot 'OU=GrouOU,DC=company,DC=com' -Sizelimit 0 -LdapFilter '(msExchExpansionServerName=EXCHSVR05)' | foreach {set-QADgroup -msExchExpansionServerName EXCHSVR07}

Open in new window

0
 
LVL 5

Author Closing Comment

by:ncomper
ID: 33723542
Thanks
0

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
This video discusses moving either the default database or any database to a new volume.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now