public override void ExecuteCmdlet() { try { string deviceid = null; switch (ParameterSetName) { case StorSimpleCmdletParameterSet.IdentifyById: if (StorSimpleClient.IsValidDeviceId(DeviceId)) { deviceid = DeviceId; } else { throw new ArgumentException(string.Format(Resources.NoDeviceFoundWithGivenIdInResourceMessage, StorSimpleContext.ResourceName, DeviceId)); } break; case StorSimpleCmdletParameterSet.IdentifyByName: deviceid = StorSimpleClient.GetDeviceId(DeviceName); if (deviceid == null) { throw new ArgumentException(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, DeviceName)); } break; default: break; } if (string.IsNullOrEmpty(deviceid)) { WriteObject(null); return; } var dcgroupList = StorSimpleClient.GetFaileoverDataContainerGroups(deviceid).DataContainerGroupResponse.DCGroups; WriteObject(dcgroupList); WriteVerbose(string.Format(Resources.ReturnedCountDataContainerGroupMessage, dcgroupList.Count, dcgroupList.Count > 1 ? "s" : string.Empty)); } catch (Exception exception) { this.HandleException(exception); } }