public override void ExecuteCmdlet() { try { var deviceid = StorSimpleClient.GetDeviceId(DeviceName); if (deviceid == null) { WriteVerbose(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, DeviceName)); WriteObject(null); return; } if (VolumeContainerName == null) { var dataContainerList = StorSimpleClient.GetAllDataContainers(deviceid); WriteObject(dataContainerList.DataContainers); WriteVerbose(string.Format(Resources.ReturnedCountDataContainerMessage, dataContainerList.DataContainers.Count, dataContainerList.DataContainers.Count > 1 ? "s" : string.Empty)); } else { var dataContainer = StorSimpleClient.GetDataContainer(deviceid, VolumeContainerName); if (dataContainer != null && dataContainer.DataContainerInfo != null && dataContainer.DataContainerInfo.InstanceId != null) { WriteObject(dataContainer.DataContainerInfo); WriteVerbose(string.Format(Resources.FoundDataContainerMessage, VolumeContainerName)); } else { WriteVerbose(string.Format(Resources.NotFoundDataContainerMessage, VolumeContainerName)); } } } catch (Exception exception) { this.HandleException(exception); } }