help with Get-Mailbox methods

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
jvierra
Posts: 14444
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Tue May 22, 2007 9:57 am
Contact:

help with Get-Mailbox methods

Post by jvierra »

I don't understand. We haven't done anything other than prove you can enumerate teh table.

There is something wrong with what yo are typing into the PS session. We need to try the next step.

$DebugPreference = "Continue"

$table | % { [string]$alias = $_.alias; write-debug $alias; Get-Mailbox -Identity $alias }


jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

help with Get-Mailbox methods

Post by jvierra »

Try this with table.

$table[0].Alias

Does this give you a value or nothing?


jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

help with Get-Mailbox methods

Post by jvierra »

What happens when you just type $table

Do you see all of the data?


I am beginning to feel that you are not telling me some critical piece of information. What could that be?

jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

help with Get-Mailbox methods

Post by jvierra »

Does $table[0] give you just the first row?

What does $table[0]|gm look like?


User avatar
jadamski
Posts: 32
Joined: Thu Apr 03, 2008 12:00 am

help with Get-Mailbox methods

Post by jadamski »

yep both of those work and give me the first row information or just alias.

User avatar
jadamski
Posts: 32
Joined: Thu Apr 03, 2008 12:00 am

help with Get-Mailbox methods

Post by jadamski »

it gives me the first alias

PS H:> $table[0].aliasdickeyPS H:>

User avatar
jadamski
Posts: 32
Joined: Thu Apr 03, 2008 12:00 am

help with Get-Mailbox methods

Post by jadamski »

that seems to work also

PS H:> foreach($row in $table){$row.alias}dickeylindaaktatedvoshall

User avatar
jadamski
Posts: 32
Joined: Thu Apr 03, 2008 12:00 am

help with Get-Mailbox methods

Post by jadamski »

these seem to work:

PS H:> foreach($row in $table){Get-Mailbox -Identity $row.alias}
Name Alias ServerName ProhibitSendQuota---- ----- ---------- -----------------Michele Dickey-Kotz dickey owlery unlimitedLinda Armstrong LINDAA athena unlimitedktate ktate hermes unlimitedDavid Voshall dvoshall hermes unlimitedNancy Halferty halferty owlery unlimitedjbbradle jbbradle athena unlimitedheissere heissere hermes unlimitedjarice jarice hermes unlimitedPat Trachsel trachsel hermes 90000KBMegan Sherwood-Pollard sherwood owlery unlimitedPS H:> foreach($row in $table){Get-Mailbox -Identity $row.alias.Trim()}
Name Alias ServerName ProhibitSendQuota---- ----- ---------- -----------------Michele Dickey-Kotz dickey owlery unlimitedLinda Armstrong LINDAA athena unlimitedktate ktate hermes unlimitedDavid Voshall dvoshall hermes unlimitedNancy Halferty halferty owlery unlimitedPS H:> foreach($row in $table){Get-Mailbox -Identity $row.alias.ToString()}
Name Alias ServerName ProhibitSendQuota---- ----- ---------- -----------------Michele Dickey-Kotz dickey owlery unlimitedLinda Armstrong LINDAA athena unlimitedktate ktate hermes unlimitedDavid Voshall dvoshall hermes unlimitedNancy Halferty halferty owlery unlimitedjbbradle jbbradle athena unlimitedheissere heissere hermes unlimitedjarice jarice hermes unlimitedPat Trachsel trachsel hermes 90000KBPS H:>

User avatar
jadamski
Posts: 32
Joined: Thu Apr 03, 2008 12:00 am

help with Get-Mailbox methods

Post by jadamski »

yep these worked. strange very similar to what I started with. Oh well will go from here.

PS H:> $table|%{$_.alias}dickeylindaaktatedvoshallhalfertyjbbradleheissere
PS H:> $table|%{Get-mailbox -Identity $_.alias}
Name Alias ServerName ProhibitSendQuota---- ----- ---------- -----------------Michele Dickey-Kotz dickey owlery unlimitedLinda Armstrong LINDAA athena unlimitedktate ktate hermes unlimitedDavid Voshall dvoshall hermes unlimitedNancy Halferty halferty owlery unlimitedjbbradle jbbradle athena unlimited

jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

help with Get-Mailbox methods

Post by jvierra »

Marco

It works - looks liike some kind of interesting typo.

The need for teh "foreach" is because the "row" gets re-wrapped in a collection when passed in the pipeline. Seems to be a charcateristic of rowsets.


Locked