Skip to content

Instantly share code, notes, and snippets.

@Windos
Created April 27, 2016 08:44
Show Gist options
  • Save Windos/ceff8b758c6ab1fa472fcb8b97cfd56c to your computer and use it in GitHub Desktop.
Save Windos/ceff8b758c6ab1fa472fcb8b97cfd56c to your computer and use it in GitHub Desktop.
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