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
723 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

717 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