########################################################################## # ScriptName: Set-EAS.ps1 # Author: John Barsodi # Date: 1/12/10 # Version: .1 # Desc: Sets the EAS Mailbox feature to False if not member of # Desc: the AD group # Tags: Group EAS ########################################################################## Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin $AdminSessionADSettings.ViewEntireForest = $True $grpGuid = "YourGroupGUIDHere" $grpdn = (Get-group $grpGuid).DistinguishedName $grpBind = [ADSI]"LDAP://$grpdn" $members = $grpBind.Member $EnabledEAS = (Get-CasMailbox -resultsize unlimited | where {$_.ActiveSyncEnabled -eq "True"}) Foreach ($obj in $EnabledEAS){ $UserDN = $obj.DistinguishedName $UserDisplayName = $obj.Name If($members -contains $UserDN){ Write-Host -ForegroundColor Green "$UserDisplayName found in Group" } Else{ Set-CasMailbox $UserDisplayName -ActiveSyncEnabled $false Write-Host -ForegroundColor Red "$UserDisplayName not found in Group" } }