public override void ExecuteCmdlet() { try { string sourceDeviceIdentifierInMessage = string.IsNullOrEmpty(DeviceName) ? DeviceId : DeviceName; string targetDeviceIdentifierInMessage = string.IsNullOrEmpty(TargetDeviceName) ? TargetDeviceId : TargetDeviceName; ConfirmAction( Force.IsPresent, string.Format(Resources.StartDeviceFailoverJobWarningMessage, sourceDeviceIdentifierInMessage, targetDeviceIdentifierInMessage), string.Format(Resources.StartDeviceFailoverJobMessage, sourceDeviceIdentifierInMessage, targetDeviceIdentifierInMessage), string.Empty, () => { string deviceId = null; string targetDeviceId = null; switch (ParameterSetName) { case StorSimpleCmdletParameterSet.IdentifyById: deviceId = DeviceId; targetDeviceId = TargetDeviceId; break; case StorSimpleCmdletParameterSet.IdentifyByName: deviceId = StorSimpleClient.GetDeviceId(DeviceName); targetDeviceId = StorSimpleClient.GetDeviceId(TargetDeviceName); if (deviceId == null) { throw new ArgumentException(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, DeviceName)); } if (targetDeviceId == null) { throw new ArgumentException(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, TargetDeviceName)); } break; default: break; } if (string.IsNullOrEmpty(deviceId) || string.IsNullOrEmpty(targetDeviceId)) { WriteObject(null); return; } if (!ValidTargetDeviceForFailover(deviceId, targetDeviceId)) { WriteObject(null); return; } var vcIdList = StorSimpleClient.GetVcIdListFromVcGroups(VolumecontainerGroups); var drRequest = new DeviceFailoverRequest() { DataContainerIds = vcIdList, TargetDeviceId = targetDeviceId, CleanupPrimary = true, ReturnWorkflowId = true }; var jobResponse = StorSimpleClient.TriggerFailover(deviceId, drRequest); HandleDeviceJobResponse(jobResponse, "start"); }); } catch (Exception exception) { this.HandleException(exception); } }