Hi Guys,
Thank you for all of the great feedback. I was unexpected out of the office for a few days and have just submitted the new updated version of this post. Hopefully it will be up in the next day or two.
I also carred on some interesting discussions with our developers on the get-mailbox comdlet and the behavior that I was seeing when testing with it.
The net result of that is that YES the get-mailbox comdlet will pass data down the pipeline as it gets a completed page back from AD (watch thoese customer that have changed the default page size).
Also I finally got a chance to test just removing the foreach completely and going with get-mailboxserver | get-mailbox ... and yes that does appear to accomplish the same thing.
So some lessons learned on my part (thanks to the community for pointing out the errors in my observations) and some rules I am going to follow going forward:
1) When in doubt, avoid foreach if you can. It is a simple matter to take a look at the help on the cmdlet you are pipelining too and see if the value you are looking to send in is marked as being pipelinable.
-Server <ServerIdParameter>
.
.
Accept pipeline input? True
Accept wildcard characters? false
2) When using an alias make sure to document that you are using an alias to ensure that people are clear on what is being used where.
3) The book Windows Powershell in Action by Bruce Payette is a wonderful read and I strongly recommend it to anyone seriously interested in learning about powershell.
I am already working on Volume 3 ... it is going to be a collect of common functions I have created and placed in my profile. So if you have any suggestions please let me know.
-Matt