I am searching a specific OU, then disabling OWA for all users in the OU. This script runs daily.
I have the following script that works properly but is updating ALL the users in the OU.
$OU='OU=SomeOU,DC=Domain,DC=com'
$ext14='00254'
Get-Mailbox -OrganizationalUnit $OU| Where {$_.CustomAttribute14 -eq $ext14} | Set-CASMailbox -OWAEnabled:$false
I would like to ONLY update users that -OWAEnabled is set to $True
(and change to $false) in this OU and sub OUs. This would reduce my calls to Exchange.
Unfortunately, Set-CASMailbox
does not seem to have an OU
or CustomAttribute
property to query against.
Any suggestions??