Friday, September 24, 2010

Consultant Names and Email Address Report

Yesterday I posted a script showing how to change consultant passwords and email the new password to them. This is great until someone asks for the list of people that it will affect and you try to verify the email addresses. The solution is another very simple PowerShell script to just kick out that data which I just put into an email for whomever is asking.
Import-Module ActiveDirectory

$Consultants = Get-ADGroupMember "Role_Consultants" -Recursive

$Allusers = New-Object System.Collections.ArrayList

foreach ($user in $Consultants) {
    $tempUser = Get-ADUser -Identity $user -Properties emailaddress

$Allusers | Select-Object Name, EmailAddress

No comments:

Post a Comment