Jacob’s Lifestream

Stranger things have happened... 
Filed under

Active Directory

 

Get a list of users’ email addresses « Dmitry’s PowerBlog: PowerShell and beyond

Here’s the oneliner (for PowerShell v2):

(Get-QADGroupMember MyGroupName -Type user -Indirect |
    Select -expand Email) -join ';'

PowerShell v1 version has a slightly different syntax for join:

[string]::join(';',
  (Get-QADGroupMember MyGroupName -Type user -Indirect |
    Select -expand Email))

Whoopass Dmitry !

Always was hugely annoyed by not being able to retrieve the e-mail addresses, once they, in total, became too long.

Will definitely be using this myself !

Loading mentions Retweet
Filed under  //   Active Directory   PowerShell  

Comments [0]

Exchange/AD: Finding users whose mail is forwarded

I was asked earlier by one of my colleagues, if there was a way to find out which users have their mail forwarded to other users. I answered no, cause I don't know of a way to do that. So, just now my colleague Thomas presented me with the answer:

get-qaduser -SizeLimit 0 -IncludedProperties altrecipient -ldapfilter '(&(mail=*)(altRecipient=*))' | Select-Object -property "name","description","altrecipient" | where {$_.altrecipient -like "*Put a name here*"}

Pretty cool :) Updated at 17:14, the powershell code was a bit too long ;)

Loading mentions Retweet
Filed under  //   Active Directory   Exchange   PowerShell  

Comments [0]

How many users in a group hierarchy ?

Was doing some statistics for our knowledge networks today. Our KN Facilitator said the other day, she'd really like to know how many unique members we had in our knowledge networks. Now, normally, that'd be a really timeconsuming task, however simple it was. Fortunately, I have PowerShell and the Quest AD commandlets. So it's actually this simple.

Get-QADGroupMember "Group Name Here" -Indirect | where {$_.Type -eq "User"} | sort

Get-QADGroupMember is the commandlet of choice, if you want to get members of a group.

However, if you don't just want a list of groups in that group, you should add the "-Indirect" parameter, which tells it to traverse the group hierarchy.

Since that would also get me all of the subgroups and public folders that are members of that main group, I need to search for users only. Hence, the added where clause.

And the final touch: Sorting the output.

In the future: I'll add a bit of statistics showing how many knowledge networks the members are part of, and if I can find a suitable graphical way of doing it, a map of the relations between the knowledge networks, based on member participation.

Loading mentions Retweet
Filed under  //   Active Directory   PowerShell  

Comments [0]