Link to home
Start Free TrialLog in
Avatar of Snow Drift
Snow DriftFlag for United States of America

asked on

Disable Mailbox Features for Except for Select Group's and OU's

Hello, I am weak in PowerShell and I am cleaning up a messy Exchange 2010 environment. Management wants OWA, IMAP, POP3, and ActiveSync disabled for all users in the domain. However they want one security group of VIP's and another OU with many subfolders to have OWA and ActiveSync enabled. What I have so far would disable the features for all then turn on the features for the select group and OU's. Is there a way to exclude the "ON" users from being disabled in the first place?  Thank you.

Disables Features for all mailboxes.
Get-mailbox -OrganizationalUnit "DC=MyCompany,DC=com" | Set-CasMailbox -OWAEnabled $False
Get-mailbox -OrganizationalUnit "DC=MyCompany,DC=com" | Set-CasMailbox -ActiveSyncEnabled $False
Get-mailbox -OrganizationalUnit "DC=MyCompany,DC=com" | Set-CasMailbox -ImapEnabled $False
Get-mailbox -OrganizationalUnit "DC=MyCompany,DC=com" | Set-CasMailbox -PopEnabled $False


Enabled for users in the VipUsers users group.
Get-ADGroup -filter {name -like 'VipUsers'} | Get-ADGroupMember -Recursive | Get-ADUser -Properties MailNickName | select -ExpandProperty MailNickName | Set-CasMailbox -OWAEnabled $true
Get-ADGroup -filter {name -like 'VipUsers'} | Get-ADGroupMember -Recursive | Get-ADUser -Properties MailNickName | select -ExpandProperty MailNickName | Set-CasMailbox -ActiveSyncEnabled $true

Enabled for users in the TravelingUsers OU.
Get-mailbox -OrganizationalUnit "OU=TravelingUsers,OU=Users,DC=MyCompany,DC=com" | Set-CasMailbox -OWAEnabled $True
Get-mailbox -OrganizationalUnit "OU=TravelingUsers,OU=Users,DC=MyCompany,DC=com" | Set-CasMailbox -ActiveSyncEnabled $True
ASKER CERTIFIED SOLUTION
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Snow Drift

ASKER

Thank you, it is much cleaner than what I had.
My pleasure.  Have a good one :)