public static IEnumerable <SmbShare> EnumerateInstances( string computerName = ".", NetworkCredential credentials = default) { var classInfo = typeof(SmbShare).GetCustomAttribute <ManagementObjectAttribute>(); foreach (var o in WMI.Query(classInfo.GetQuery(), classInfo.GetScope(computerName, credentials))) { yield return(WMI.Bind <SmbShare>((ManagementObject)o)); } }