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.
This topic is 15 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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
Last visit: Tue Sep 22, 2009 12:32 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
Last visit: Tue Sep 22, 2009 12:32 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
Last visit: Tue Sep 22, 2009 12:32 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
Last visit: Tue Sep 22, 2009 12:32 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
Last visit: Tue Sep 22, 2009 12:32 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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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.

This topic is 15 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked