Forum Discussion
Lee Mayger
Oct 22, 2017Brass Contributor
How to stop a ForEach Loop?
Hi, I have the following simple script that works fine, but continually loops once it has finished displaying the necessary information. Does anyone know what I need to change to get it to displa...
Paul Cunningham
Oct 23, 2017Iron Contributor
Your Get-Mailbox will be returning every mailbox in your org, and that will repeat for every $name that's in your mailbox user CSV list.
Looks like you should use "Get-Mailbox -Mailbox $name" so that it returns the single mailbox to pass to Get-MailboxPermission.
- Lee MaygerOct 23, 2017Brass Contributor
Thanks Paul, will give that a try this morning.