TacoFlavoredKisses
asked on
Ldap query to find all users with a certain alias
What query can be used to find all users that have an alias with @domainB.com? I see how to find the primary ones, but not aliases. If the query could also return the users name and what all the aliases are, that would be useful as well.
ASKER
vbscript is fine.
Any that have that, regardless of what others they have is fine. Formatting it so we can tell what user has what would be great.
Any that have that, regardless of what others they have is fine. Formatting it so we can tell what user has what would be great.
You could do this in a one liner if you use the powershell quest cmdlets for AD:
http://www.quest.com/powershell/activeroles-server.aspx
The Command below creates a csv file with a list of all users that have @domainb.com in their proxyaddress attribute as well as there accountname and displayname
http://www.quest.com/powershell/activeroles-server.aspx
The Command below creates a csv file with a list of all users that have @domainb.com in their proxyaddress attribute as well as there accountname and displayname
get-qaduser -sizelimit 0 -ldapfilter "(proxyAddresses=*@domainB.com)" -IncludedProperties proxyAddresses | select samaccountname,displayname,proxyAddresses | export-csv c:\temp\Aliasinfo.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not currently using powershell in this exchange 2003 environment.
Even though it is exchange 2003 you can still use the quest powershell cmdlets on an xp machine to complete the query. No need to install on the server as the attributes are stored in AD so you just need a PC and a standard user who will have read access to AD.
My VB skills are not great so if you need it in VB I will leave it to Chris :-)
Cheers
GM
My VB skills are not great so if you need it in VB I will leave it to Chris :-)
Cheers
GM
Sorry, had to sleep.
I would also recommend PowerShell, it's lovely for tasks like this, far more accessible than VbScript.
I'll post a VbScript version in a couple of minutes so you have a full set :)
Pubeheed,
> slight change export-csv does not hand the proxy address
Force it into a string using a custom property and it'll be fine:
Get-QADUser -SizeLimit 0 -LdapFilter "(proxyAddresses=*@domainB
-IncludedProperties proxyAddresses | Select-Object samaccountname, `
displayname, @{n='EmailAddresses';e={ "$($_.proxyAddresses)" }} | `
Export-CSV c:\temp\Aliasinfo.csv
Has the same effect as [String]::Join(" ", $_.ProxyAddresses).
Chris
cheers Chris !
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
This should do it:
(proxyAddresses=*@domainB.
Or did you want those that only have the alias?
You might be better having a script do this for you. Do you have any preference on scripting language?
Chris