I'm running Windows 7 Professional.
I know how to get a list of all the users in a group:
$ou="User Groups"
$userADName="RRAS VPN SSL"
$userADPath="LDAP://proddc6.prod.root/CN="+$userADName+",OU="+$ou+",DC=prod,DC=root"
$user = [adsi] $userADPath
$user.Member
I tried iterating over that list, creating an [adsi]
object for each:
$ou="User Groups"
$userADName="RRAS VPN SSL"
$userADPath="LDAP://proddc6.prod.root/CN="+$userADName+",OU="+$ou+",DC=prod,DC=root"
$user = [adsi] $userADPath
$user.Member| ForEach-Object {[adsi] ("ldap://proddc6.prod.root/" + $_)}
I was thinking of looping over the list of objects and fetching the email address and full name, then running some commands using that information. Instead, this produces the error:
The following exception occurred while retrieving member "PSComputerName": "Unknown error (0x80005000)"
+ CategoryInfo : NotSpecified: (:) [format-default], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember,Microsoft.PowerShell.Commands.FormatDefaultCommand
How can I iterate over the list of users in a group, processing the email address and full name for each user?