I have a report that is serving me quite well. Recently I had a request to add in the report an option display MS Exchange 2013 Database name. This can be taken from AD attribute 'HOMEMDB' Right now this what the attribute has inserted for one of my users.
HOMEMDB 'CN=AMRL,CN=Databases,CN=Exchange Administrative Group (FYDIBEDLT),CN=Administrative Groups,CN=DOMAIN,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DOMAIN,DC=com'
I would like this to be added to my below report to show only "AMRL" as DB name.
Select Top 1000000 tblADusers.Username,
tblADusers.Displayname,
tblADusers.EmployeeID As [EC NO.],
tblADusers.email As [E-mail],
'usersm.png' As icon,
Replace(Replace(Replace(Replace(tblADusers.OU, 'OU=Computers,', ''),
',DC=DOMAIN,', ''), 'DC=com', ''), 'OU=', '') As Department,
tblADusers.Lastchanged
From tblADusers
Where tblADusers.email Is Not Null And
tblADusers.email Like '%@DOMAIN.com'
Order By [EC NO.] Desc
Thanks for your support.