Powershell – Get a list of Exchange Users
Posted by: Colin Smith
In my last post I talked about using the Exchange Management Shell to get a list of users that needed to be placed into a group. Here is what we did. First we had to determine how we could find just the users that were of interest to us. We know that we had set two Custom Attributes on each of these users mailboxes so we decided to use that as a search filter. This is a pretty simple one liner but very effective and powerful.
Get-mailbox | where-object{$_.CustomAttribute15 –eq “some value”} | format-table Name | out-file “path to file”
So that looks at all mailboxes on the domain and will return only the names of the users whose mailboxes have CustomAttribute15 set to the value that we were looking for. Now that I have that list I am ready to move on to putting those users in the group. If I added the snap in for the Quest AD Command lets then I could have just used another | to that command and not even needed the file. We wanted that for records and to verify that the correct users were being modified. Again if you have any questions or comments about this please let me know by leaving them here or heading out to my website SysAdminSmtih.com and submitting a question to me.



You must be logged-in to post a comment. Log-in/Register