Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
May 2016 Scripting Games Submission, Windos
$Group = Read-Host -Prompt 'Specify problem group'
Get-AdGroupMember -Identity $Group -Recursive |
Where-Object -FilterScript {$_.objectClass -eq 'user'} |
Get-AdUser -Properties 'EmailAddress', 'Department' |
Select-Object 'Name', 'EmailAddress', 'Department'
<#
Assumptions:
* Execution policy configured so this can run
* Person running this has proper access to Active Directory
* It sound like you're the only powershell person, so I'm not
worrying about the output being useful for followup commands
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.