//not overriding BeginProcessing so resource context validation will happen here public override void ExecuteCmdlet() { try { List <IscsiConnection> iscsiConnections = null; var currentResourceName = StorSimpleClient.GetResourceContext().ResourceName; string deviceIdFinal = null; if (ParameterSetName == StorSimpleCmdletParameterSet.IdentifyByName) { var deviceToUse = StorSimpleClient.GetAllDevices().Where(x => x.FriendlyName.Equals(DeviceName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (deviceToUse == null) { throw new ArgumentException(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, currentResourceName, DeviceName)); } deviceIdFinal = deviceToUse.DeviceId; } else { deviceIdFinal = DeviceId; } //verify that this device is configured this.VerifyDeviceConfigurationCompleteForDevice(deviceIdFinal); iscsiConnections = StorSimpleClient.GetAllIscsiConnections(deviceIdFinal); WriteObject(iscsiConnections); WriteVerbose(string.Format(Resources.IscsiConnectionGet_StatusMessage, iscsiConnections.Count, (iscsiConnections.Count > 1?"s":string.Empty))); } catch (Exception exception) { this.HandleException(exception); } }