Set-ExchangeMailboxActiveSyncConfig
Exchange: Configures ActiveSync settings for a mailbox
#Requires -Version 5.1
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[string]$Identity,
[Parameter(Mandatory = $true)]
[bool]$Enabled,
[string]$Policy
)
Process {
try {
$params = @{
'Identity' = $Identity
'ActiveSyncEnabled' = $Enabled
'Confirm' = $false
'ErrorAction' = 'Stop'
}
if ($Policy) { $params.Add('ActiveSyncMailboxPolicy', $Policy) }
Set-CASMailbox @params
$mailbox = Get-CASMailbox -Identity $Identity -ErrorAction Stop
$result = [PSCustomObject]@{
Identity = $Identity
ActiveSyncEnabled = $mailbox.ActiveSyncEnabled
Policy = $mailbox.ActiveSyncMailboxPolicy
Action = "ActiveSyncConfigUpdated"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the Identity of the mailbox (Alias, Email, GUID, etc.).
Specifies whether ActiveSync should be enabled ($true) or disabled ($false).
Optionally specifies the ActiveSync mailbox policy to apply.