internal static List<CimInstance> GetAndPrintInstances(CimSession cimSession, string cimNamespace, string cimClassName)
        {
            IEnumerable<CimInstance> enumeratedInstances;
            try
            {
                enumeratedInstances = cimSession.EnumerateInstances(cimNamespace, cimClassName);
            }
            catch (CimException exception)
            {
                Console.WriteLine("Unable to get instances of class {0} in namespace {1}", cimClassName, cimNamespace);
                PrintCimException(exception);
                return null;
            }

            List<CimInstance> list = new List<CimInstance>();
            int count = 0;
            foreach (var enumeratedInstance in enumeratedInstances)
            {
                list.Add(enumeratedInstance);
                bool bSingleton = true;
                var keyProperties = from p in enumeratedInstance.CimInstanceProperties where ((p.Flags & CimFlags.Key) == CimFlags.Key) select p;
                foreach (var enumeratedProperty in keyProperties)
                {
                    if (bSingleton) 
                        bSingleton = false;
                    Console.WriteLine(
                        "Id: {0} : Name: {1}, Type: {2}, Value: {3}",
                        count,
                        enumeratedProperty.Name,
                        enumeratedProperty.CimType,
                        enumeratedProperty.Value);
                }
                if (bSingleton)
                {
                    Console.WriteLine("Id: {0}", count);
                }

                count++;
            }

            return list;
        }
        public static void EnumerateSync(CimSession cimSession, string cimNamespace, string cimClassName)
        {
            // Check Arguments
            if (cimNamespace == null)
            {
                throw new ArgumentNullException("cimNamespace");
            }

            if (cimClassName == null)
            {
                throw new ArgumentNullException("cimClassName");
            }

            try
            {
                IEnumerable<CimInstance> enumeratedInstances = cimSession.EnumerateInstances(cimNamespace, cimClassName);
                foreach (CimInstance cimInstance in enumeratedInstances)
                {
                    // Use the instance
                    PrintCimInstance(cimInstance);
                }
            }
            catch (CimException ex)
            {
                PrintCimException(ex);
            }
            catch( Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }