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
719 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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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 …

733 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