I am using c# wmi calls to connect to connect to ISCSI LUN through ISCSI initiator. I am using windows server 2012 r2. From server manager I am able to connect through ISCSI initiator. From GUI every thing is working fine. I am able to list ISCSISessions through ISCSISession.GetInstances() in c# code. WmiExplorer is also showing that connect method is there. Generated class contains the connect() method.
System.Management.ManagementException was unhandled by user code
HResult=-2146233087
Message=Not found
Source=System.Management
StackTrace:
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObject.Initialize(Boolean getObject)
at System.Management.ManagementObject.get_ClassPath()
at System.Management.ManagementObject.GetMethodParameters(String methodName, ManagementBaseObject& inParameters, IWbemClassObjectFreeThreaded& inParametersClass, IWbemClassObjectFreeThreaded& outParametersClass)
at System.Management.ManagementObject.GetMethodParameters(String methodName)
at ROOT.MICROSOFT.WINDOWS.STORAGE.ISCSITarget.Connect(String AuthenticationType, String ChapSecret, String ChapUsername, String InitiatorInstanceName, String InitiatorPortalAddress, Boolean IsDataDigest, Boolean IsHeaderDigest,
Boolean IsMultipathEnabled, Boolean IsPersistent, String NodeAddress, Boolean ReportToPnP, String TargetPortalAddress, UInt16 TargetPortalPortNumber, ManagementBaseObject& CreatediSCSISession) at ROOT.Microsoft.Windows.Storage.MSFT_iSCSITarget.cs:line
402