protected override void InternalProcessRecord() { TaskLogger.LogEnter(); MailboxSession mailboxSession = null; try { mailboxSession = MailboxSession.OpenAsAdmin(this.principal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-ActiveSyncDeviceStatistics"); DeviceInfo deviceInfo = MobileDeviceTaskHelper.GetDeviceInfo(mailboxSession, this.Identity); if (deviceInfo == null) { base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity); } using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(mailboxSession, deviceInfo.DeviceIdentity, null)) { if (syncStateStorage == null) { base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity); } using (CustomSyncState orCreateGlobalSyncState = AirSyncUtility.GetOrCreateGlobalSyncState(syncStateStorage)) { if (this.Cancel) { if (!DeviceInfo.CancelRemoteWipeFromMailbox(orCreateGlobalSyncState)) { this.WriteWarning(Strings.CannotCancelWipe(this.Identity.ToString())); } } else { DeviceInfo.StartRemoteWipeFromMailbox(syncStateStorage, orCreateGlobalSyncState, ExDateTime.UtcNow, this.validatedAddresses, this.wipeRequestorSMTP); } orCreateGlobalSyncState.Commit(); } } base.InternalProcessRecord(); } catch (FolderSaveException exception) { base.WriteError(exception, ErrorCategory.WriteError, this.Identity); } catch (CorruptSyncStateException ex) { TaskLogger.LogError(ex); base.WriteError(ex, ErrorCategory.ReadError, this.principal); } catch (InvalidSyncStateVersionException ex2) { TaskLogger.LogError(ex2); base.WriteError(ex2, ErrorCategory.ReadError, this.principal); } catch (StorageTransientException ex3) { TaskLogger.LogError(ex3); base.WriteError(ex3, ErrorCategory.ReadError, this.principal); } catch (StoragePermanentException ex4) { TaskLogger.LogError(ex4); base.WriteError(ex4, ErrorCategory.InvalidOperation, this.principal); } catch (InvalidOperationException ex5) { TaskLogger.LogError(ex5); base.WriteError(ex5, ErrorCategory.InvalidOperation, this.principal); } finally { if (mailboxSession != null) { mailboxSession.Dispose(); } TaskLogger.LogExit(); } }