当前位置: 首页>>代码示例>>C#>>正文


C# ManagementClass.Delete方法代码示例

本文整理汇总了C#中System.Management.ManagementClass.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# ManagementClass.Delete方法的具体用法?C# ManagementClass.Delete怎么用?C# ManagementClass.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Management.ManagementClass的用法示例。


在下文中一共展示了ManagementClass.Delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Uninstall

        public override void Uninstall(IDictionary savedState)
        {

            try
            {
                ManagementClass MC = new ManagementClass(@"root\cimv2:Win32_Evil");
                MC.Delete();
            }
            catch { }

            try
            {
                base.Uninstall(savedState);
            }
            catch { }
        }
开发者ID:int347,项目名称:EvilWMIProvider,代码行数:16,代码来源:EvilWMIProvider.cs

示例2: Uninstall

        public override void Uninstall(IDictionary savedState)
        {

            try
            {
                new System.EnterpriseServices.Internal.Publish().GacRemove("WMIKatz.dll");
                ManagementClass MC = new ManagementClass(@"root\cimv2:Win32_WMIKatz");
                MC.Delete();
            }
            catch { }

            try
            {
                base.Uninstall(savedState);
            }
            catch { }
        }
开发者ID:subTee,项目名称:Troopers2016,代码行数:17,代码来源:WMIKatz.cs

示例3: RegisterNonAssemblySpecificSchema

		public void RegisterNonAssemblySpecificSchema(InstallContext installContext)
		{
			SecurityHelper.UnmanagedCode.Demand();
			WmiNetUtilsHelper.VerifyClientKey_f();
			SchemaNaming.InstallLogWrapper installLogWrapper = new SchemaNaming.InstallLogWrapper(installContext);
			SchemaNaming.EnsureNamespace(installLogWrapper, this.GlobalRegistrationNamespace);
			SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalInstrumentationClassPath, new SchemaNaming.ClassMaker(this.MakeGlobalInstrumentationClass));
			SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalRegistrationClassPath, new SchemaNaming.ClassMaker(this.MakeNamespaceRegistrationClass));
			SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalNamingClassPath, new SchemaNaming.ClassMaker(this.MakeNamingClass));
			SchemaNaming.EnsureNamespace(installLogWrapper, this.NamespaceName);
			SchemaNaming.EnsureClassExists(installLogWrapper, this.InstrumentationClassPath, new SchemaNaming.ClassMaker(this.MakeInstrumentationClass));
			SchemaNaming.EnsureClassExists(installLogWrapper, this.RegistrationClassPath, new SchemaNaming.ClassMaker(this.MakeRegistrationClass));
			try
			{
				ManagementClass managementClass = new ManagementClass(this.DecoupledProviderClassPath);
				if (managementClass["HostingModel"].ToString() != "Decoupled:Com")
				{
					managementClass.Delete();
				}
			}
			catch (ManagementException managementException1)
			{
				ManagementException managementException = managementException1;
				if (managementException.ErrorCode != ManagementStatus.NotFound)
				{
					throw managementException;
				}
			}
			SchemaNaming.EnsureClassExists(installLogWrapper, this.DecoupledProviderClassPath, new SchemaNaming.ClassMaker(this.MakeDecoupledProviderClass));
			SchemaNaming.EnsureClassExists(installLogWrapper, this.ProviderClassPath, new SchemaNaming.ClassMaker(this.MakeProviderClass));
			if (!SchemaNaming.DoesInstanceExist(this.GlobalRegistrationPath))
			{
				this.RegisterNamespaceAsInstrumented();
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:35,代码来源:SchemaNaming.cs

示例4: RegisterNonAssemblySpecificSchema

        public void RegisterNonAssemblySpecificSchema(InstallContext installContext)
        {
            SecurityHelper.UnmanagedCode.Demand(); // Bug#112640 - Close off any potential use from anything but fully trusted code
            
            // Make sure the 'Client' key has the correct permissions
            WmiNetUtilsHelper.VerifyClientKey_f();

            InstallLogWrapper context = new InstallLogWrapper(installContext);

            EnsureNamespace(context, GlobalRegistrationNamespace);

            EnsureClassExists(context, GlobalInstrumentationClassPath, new ClassMaker(MakeGlobalInstrumentationClass));

            EnsureClassExists(context, GlobalRegistrationClassPath, new ClassMaker(MakeNamespaceRegistrationClass));

            EnsureClassExists(context, GlobalNamingClassPath, new ClassMaker(MakeNamingClass));

            EnsureNamespace(context, NamespaceName);

            EnsureClassExists(context, InstrumentationClassPath, new ClassMaker(MakeInstrumentationClass));

            EnsureClassExists(context, RegistrationClassPath, new ClassMaker(MakeRegistrationClass));

            // Make sure Hosting model is set correctly by default.  If not, we blow away the class definition
            try
            {
                ManagementClass cls = new ManagementClass(DecoupledProviderClassPath);
                if(cls["HostingModel"].ToString() != "Decoupled:Com")
                {
                    cls.Delete();
                }
            }
            catch(ManagementException e)
            {
                if(e.ErrorCode != ManagementStatus.NotFound)
                    throw e;
            }

            EnsureClassExists(context, DecoupledProviderClassPath, new ClassMaker(MakeDecoupledProviderClass));

            EnsureClassExists(context, ProviderClassPath, new ClassMaker(MakeProviderClass));

            if(!DoesInstanceExist(GlobalRegistrationPath))
                RegisterNamespaceAsInstrumented();
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:45,代码来源:SchemaRegistration.cs


注:本文中的System.Management.ManagementClass.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。