예제 #1
0
        public void SetRDPCertificate(string thumbprint)
        {
            CimInstance c     = GetCimInstance(_cim);
            var         check = !c.CimInstanceProperties[p].Value.Equals(thumbprint);

            if (check)
            {
                var prop = c.CimInstanceProperties[p];
                prop.Value = thumbprint;
                _cim.ModifyInstance(c);
            }
        }
        public static void ModifyInstanceSync(CimSession cimSession, string cimNamespace, string cimClassName)
        {
            try
            {
                CimInstance modifiedInstance = ModifyInstanceCore(cimSession, cimNamespace, cimClassName);
                if (modifiedInstance == null)
                {
                    Console.WriteLine("ModifyInstance operation not performed");
                    return;
                }

                CimInstance cimInstance = cimSession.ModifyInstance(cimNamespace, modifiedInstance);
                Console.WriteLine("Instance Modified Successfully");
                PrintCimInstance(cimInstance);
            }
            catch (CimException ex)
            {
                PrintCimException(ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }