I like this better.  YMMV

(get-group "<groupname").members |% {$_.distinguishedname | tee -var a; 
get-mailbox $a | ft -auto}

From: Michael B. Smith [mailto:mich...@smithcons.com]
Sent: Thursday, November 04, 2010 4:37 PM
To: MS-Exchange Admin Issues
Subject: RE: Power Shell and Multi Valued Attribute

Yeah, you got tripped up in the default roll up that PowerShell does.

Regardless of which, I like one-liners and would do it slightly differently. To 
wit:

((Get-Group <group-name>).Members | select DistinguishedName) |% { $d = 
$_.Distinguishedname;  write-output $d; get-mailbox -id $d -ea 0; }

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: Kleciak, Clint D A7IT [mailto:clint.klec...@cigna.com]
Sent: Thursday, November 04, 2010 3:39 PM
To: MS-Exchange Admin Issues
Subject: RE: Power Shell and Multi Valued Attribute

Revisited

I did not have any luck getting this working, when I run the following code:

/Start

$GroupMem = (Get-Group "AD_GROUP").members | select DistinguishedName
ForEach ($Member in $GroupMem)
{
Write-output $member
get-mailbox -id $member
}

/End

I get an error stating cannot convert 
"@{DistinguishedName=CN=id,ou=users,dc=domain,dc=com}" value of type.

I am assuming because it is not a String Value and it has the 
"@{DistinguishedName=".  Any suggestions.
_______________________________________
Clint Kleciak
Infrastructure Engineer Mgr
CIGNA IT
clint.klec...@cigna.com<mailto:clint.klec...@cigna.com>
1-860-226-1386


Confidential, unpublished property of CIGNA. Do not duplicate or distribute. 
Use and distribution limited solely to authorized personnel. (c) Copyright 2010 
CIGNA

From: Campbell, Rob [mailto:rob_campb...@centraltechnology.net]
Sent: Tuesday, October 26, 2010 4:12 PM
To: MS-Exchange Admin Issues
Subject: RE: Power Shell and Multi Valued Attribute

If you're doing multiple groups, you may want to do this:

$GroupMem = @((Get-Group "Name_Of_Group").members | select DistinguishedName)
ForEach ($Member in $GroupMem){
Do something
}


Otherwise, if it encounters a group with just one member it's not going to be 
happy.

From: KenM [mailto:kenmli...@gmail.com]
Sent: Tuesday, October 26, 2010 2:27 PM
To: MS-Exchange Admin Issues
Subject: Re: Power Shell and Multi Valued Attribute

this should work, it will give you the users DN

$GroupMem = (Get-Group "Name_Of_Group").members | select DistinguishedName
ForEach ($Member in $GroupMem){
Do something
}




On Tue, Oct 26, 2010 at 3:14 PM, Kleciak, Clint D A7IT 
<clint.klec...@cigna.com<mailto:clint.klec...@cigna.com>> wrote:
I am trying to modify settings of users in a group, I would like to run 
something like

$GroupMem = Get-Group "Name_Of_Group"
                ForEach ($_.Member in $GroupMem)
                Do something

Only problem is "Member" is a multi valued attribute that includes all the 
individual members.  Does anyone know a way to work around that?

thanks

_______________________________________
Clint Kleciak
Infrastructure Engineer Mgr
CIGNA IT
clint.klec...@cigna.com<mailto:clint.klec...@cigna.com>
1-860-226-1386


Confidential, unpublished property of CIGNA. Do not duplicate or distribute. 
Use and distribution limited solely to authorized personnel. (c) Copyright 2010 
CIGNA

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown. This email 
transmission may contain confidential information. This information is intended 
only for the use of the individual(s) or entity to whom it is intended even if 
addressed incorrectly. Please delete it from your files if you are not the 
intended recipient. Thank you for your compliance. Copyright 2010 CIGNA
==============================================================================


---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

**************************************************************************************************

Note:

The information contained in this message may be privileged and confidential and

protected from disclosure.  If the reader of this message is not the intended

recipient, or an employee or agent responsible for delivering this message to

the intended recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited. If you

have received this communication in error, please notify us immediately by

replying to the message and deleting it from your computer.

**************************************************************************************************

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist

------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown. This email 
transmission may contain confidential information. This information is intended 
only for the use of the individual(s) or entity to whom it is intended even if 
addressed incorrectly. Please delete it from your files if you are not the 
intended recipient. Thank you for your compliance. Copyright 2010 CIGNA
==============================================================================

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe exchangelist
**************************************************************************************************
Note: 
The information contained in this message may be privileged and confidential 
and 
protected from disclosure.  If the reader of this message is not the intended  
recipient, or an employee or agent responsible for delivering this message to  
the intended recipient, you are hereby notified that any dissemination,   
distribution or copying of this communication is strictly prohibited. If you  
have received this communication in error, please notify us immediately by  
replying to the message and deleting it from your computer. 
**************************************************************************************************

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe exchangelist

Reply via email to