Exchange poweshell script to change known attribute

I have a seemingly simple task but am having trouble getting a powershell script to run correctly.  This is an Exchange 2010 environment.

I need to have the cmdlet find all mailboxes with the attribute ExternalOOFOptions that are set to "InternalOnly" changed to "External".

Any help would be appreciated.  Thanks.
ENTPFAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Schnell SolutionsSystems Infrastructure EngineerCommented:
Get-Mailbox | Where-Object { $_.ExternalOofOptions -eq "External" } | Set-Mailbox -ExternalOofOptions "InternalOnly"

Here the description for this CMDLet:

1. Get-Mailbox
is going to generate a list for all your mailboxes

2. Where-Object { $_.ExternalOofOptions -eq "External" }
filter the previous pipelined output in order to stay just with the ones containing the attribute 'External'  for the external out of office option

3. Set-Mailbox -ExternalOofOptions "InternalOnly"
Takes all filtered objects, and apply the change to 'InternalOnly' for the ExternalOofOption
ENTPFAuthor Commented:
Thank you schnellsolutions this is exactly what I am looking for.  You had the variables backward but no worries.....this should work.  I will post again later today after I run it.  Thank you!
Schnell SolutionsSystems Infrastructure EngineerCommented:
Indeed, Thanks.

Let's update the information in case that someone requires the same solution:

Get-Mailbox | Where-Object { $_.ExternalOofOptions -eq "InternalOnly" } | Set-Mailbox -ExternalOofOptions "External"

 Here the description for this CMDLet:

 1. Get-Mailbox
 is going to generate a list for all your mailboxes

 2. Where-Object { $_.ExternalOofOptions -eq "InternalOnly" }
 filter the previous pipelined output in order to stay just with the ones containing the attribute 'External'  for the external out of office option

 3. Set-Mailbox -ExternalOofOptions "External"
 Takes all filtered objects, and apply the change to 'InternalOnly' for the ExternalOofOption

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ENTPFAuthor Commented:
Perfect results.  Thank you for the accurate and quick response!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.