'Powershell Get Distinguished Name of Exchange Server
I'm searching to gather the Distinguished name of an exchange server to show it's version.
Here's the code I already have, in which is missing the automated function allowing to gather the DN, also, I'm loading the script from my active directory:
$Dinstinguishedname = Read-Host -Prompt 'Input Distinguished Name of your exchange server (e.g. :CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Exchange-Domain-Enzo,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=eu)'
$conteneur=get-adobject "$Dinstinguishedname"
cd AD:\$conteneur
$a=get-childitem
foreach ($i in $a){ get-adobject $i -Properties serialnumber}
Remove-Variable -Name conteneur,a,i
cd C:
Write-Host "variable cache cleared :p" -fore Red
#CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Exchange-Domain-Enzo,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=eu
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
