3

I'm having an issue with installing/uninstalling an Exchange server. I suspect the server wasn't properly removed from AD and as a result I'm getting an error. (I've already wiped the machine, the only constant is the hostname, and AD)

How do I search AD for a given host name, wherever that may be (including partial matches since a host name may be in LDAP format)?

makerofthings7
  • 8,821
  • 28
  • 115
  • 196

2 Answers2

1

The following should work. Assuming you want to search for a server name that begins with "CONTOSOEX".

Get-ADObject -SearchBase "CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com" -SearchScope Subtree -Filter {(cn -like "CONTOSOEX*")}  

To search for all text:

Get-ADObject -SearchBase "CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com" -SearchScope Subtree -Properties * -Filter * > C:\SomeDir\Exchange.txt  

Then you may open the Exchange.txt file in your favorite text editor to search for the required values.

Greg Askew
  • 34,339
  • 3
  • 52
  • 81
1

I would try and use ldp.exe, connect to the configuration partition then search for whatever you're looking for. Use ldp.exe on a DC

  1. file->Bind
  2. View->Tree then select Configuartion

Then you can search that tree for whatever you're looking for. The filter option is a little confusing to use but it may help you find what you're looking for.

I found this to be a little helpful

https://support.microsoft.com/en-us/kb/224543

and

https://technet.microsoft.com/en-us/library/aa996205(v=exchg.65).aspx#DoingASearchUsingLDP

Hope this helps you (Remember to backup just in case)

werdna92
  • 11
  • 2