ManagementClass——ManagementClass 构造函数 (ManagementPath)
NET Framework 类库
初始化 ManagementClass 类的新实例。该类表示 WMI 中的一个公共信息模型 (CIM) 管理类,如 Win32_LogicalDisk 和 Win32_Process,前者表示磁盘驱动器,后者表示进程(如 Notepad.exe)。有关更多信息,请参见“Windows Management Instrumentation”文档中的“Win32 Classes”(Win32 类),该文档位于 http://www.microsoft.com/china/msdn/library 上的 MSDN Library 中。
命名空间:System.Management
程序集:System.Management(在 system.management.dll 中)
Public Sub New ( _ path As ManagementPath _ )
Dim path As ManagementPath Dim instance As New ManagementClass(path)
public ManagementClass ( ManagementPath path )
public: ManagementClass ( ManagementPath^ path )
public ManagementClass ( ManagementPath path )
public function ManagementClass ( path : ManagementPath )
参数
- path
-
ManagementPath,它指定要绑定到哪个 WMI 类。参数必须指定一个 WMI 类路径。该类表示 WMI 中的一个 CIM 管理类。CIM 类表示包括硬件、软件、进程等在内的管理信息。有关 Windows 中可用的 CIM 类的更多信息,请参见“Windows Management Instrumentation”文档中的“Win32 Classes”(Win32 类),该文档位于 http://www.microsoft.com/china/msdn/library 上的 MSDN Library 中。
path 参数必须指定一个 WMI 类路径。
.NET Framework 安全性
完全信任直接调用方。此成员不能由部分受信任的代码使用。有关更多信息,请参见 通过部分受信任的代码使用库。
下面的示例演示如何使用 ManagementClass 构造函数初始化 ManagementClass 变量。该示例列出已创建的类的方法、属性和限定符。
Imports System Imports System.Management Class Sample Public Overloads Shared Function _ Main(ByVal args() As String) As Integer ' Get the WMI class Dim c As New ManagementClass( _ New ManagementPath("Win32_LogicalDisk")) ' Get the methods in the class Dim methods As MethodDataCollection methods = c.Methods ' display the methods Console.WriteLine("Method Names: ") For Each method As MethodData In methods Console.WriteLine(method.Name) Next Console.WriteLine() ' Get the properties in the class Dim properties As PropertyDataCollection properties = c.Properties ' display the properties Console.WriteLine("Property Names: ") For Each p As PropertyData In properties Console.WriteLine(p.Name) Next Console.WriteLine() ' Get the Qualifiers in the class Dim qualifiers As QualifierDataCollection = _ c.Qualifiers() ' display the qualifiers Console.WriteLine("Qualifier Names: ") For Each qualifier As QualifierData In qualifiers Console.WriteLine(qualifier.Name) Next End Function End Class
using System; using System.Management; public class Sample { public static void Main() { // Get the WMI class ManagementClass c = new ManagementClass( new ManagementPath("Win32_LogicalDisk")); // Get the methods in the class MethodDataCollection methods = c.Methods; // display the methods Console.WriteLine("Method Names: "); foreach (MethodData method in methods) { Console.WriteLine(method.Name); } Console.WriteLine(); // Get the properties in the class PropertyDataCollection properties = c.Properties; // display the properties Console.WriteLine("Property Names: "); foreach (PropertyData property in properties) { Console.WriteLine(property.Name); } Console.WriteLine(); // Get the Qualifiers in the class QualifierDataCollection qualifiers = c.Qualifiers; // display the qualifiers Console.WriteLine("Qualifier Names: "); foreach (QualifierData qualifier in qualifiers) { Console.WriteLine(qualifier.Name); } } }
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见。
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
.NET Framework
受以下版本支持:2.0、1.1、1.0
ManagementClass——ManagementClass 构造函数 (ManagementPath)相关推荐
- C#控制远程计算机的服务
在.net中提供了一些类来显示和控制Windows系统上的服务,并可以实现对远程计算机服务服务的访问,如System.ServiceProcess命名空间下面的ServiceController 类, ...
- 如何用VS2005制作Web安装程序
网站完成后,需要部署到目标机器上,方法有很多,直接把文件Copy到目标机器上,执行SQL脚本,配置IIS,这样可以做到:也可以使用InstallShield这样到专业制作软件来打包.本篇文章是使用VS ...
- [转]如何用VS2005制作Web安装程序
本文转自:http://blog.csdn.net/cqfeng/archive/2006/02/17/601506.aspx 原文如下: ------- 网站完成后,需要部署到目标机器上,方法有很多 ...
- 使用C#控制远程计算机的服务[转]
在.net中提供了一些类来显示和控制Windows系统上的服务,并可以实现对远程计算机服务服务的访问,如 System.ServiceProcess命名空间下面的ServiceController 类 ...
- 用VS2005制作网页对IIS进行操作
主要是想用一下VS2005,对IIS的操作在IIS Admin中本来就可以进行管理.所以将就看,无所谓有用无用哈.^_^ 在网上也找了一下,参考了一些别人的写法,如果有什么不对的,请你多指点. 本文只 ...
- 管理远程计算机服务,C#中控制远程计算机的服务的方法
C#中控制远程计算机的服务的方法 更新时间:2007年04月16日 00:00:00 作者: 在.net中提供了一些类来显示和控制Windows系统上的服务,并可以实现对远程计算机服务服务的访问, ...
- C#实现软件授权,限定MAC运行(软件license管理,简单软件注册机制)
一个绿色免安装软件,领导临时要求加个注册机制,不能让现场工程师随意复制.事出突然,只能在现场开发(离开现场软件就不受我们控了).花了不到两个小时实现了简单的注册机制,稍作整理. 基本原理:1.软件一 ...
- C#软件授权、注册、加密、解密模块源码解析并制作注册机生成license
最近做了一个绿色免安装软件,领导临时要求加个注册机制,不能让现场工程师随意复制.事出突然,只能在现场开发(离开现场软件就不受我们控了).花了不到两个小时实现了简单的注册机制,稍作整理. ...
- C#软件license管理(简单软件注册机制)
最近做了一个绿色免安装软件,领导临时要求加个注册机制,不能让现场工程师随意复制.事出突然,只能在现场开发(离开现场软件就不受我们控了).花了不到两个小时实现了简单的注册机制,稍作整理. ...
最新文章
- Qt中的TCP客户端编程
- Excel完成将多行多列数据转化为一列
- “引用作为函数参数”与 “引用作为函数返回值”
- Python3——JSON
- 直播丨分布式数据库:从PG-XL到TBASE
- 操作系统系列题型分析(更新中~)
- 微型计算机的字长不一定是字节的整数倍数,2015江苏省全国计算机等级考试二级VB笔试试卷及参考答案考试技巧重点...
- 静态页面对seo优化之详解
- 国二python考试时间_计算机国二报名每年在几月份
- 迅雷离线下载 docker
- 腐烂国度计算机配置要求,腐烂国度一周年求生版配置要求 略有小幅度提升
- 使用SendCloud企业发送邮件
- Spring理论--Spring MVC学习
- require.context()的用法
- 华为鸿蒙pc系统试用版,华为开源操作系统 鸿蒙OS 升级版曝光,打通PC等一大批硬件...
- windows phone 7---8 Belling's课堂(十五) 程序等待页面的处理
- vue-router路由有几种模式?说说它们的区别?
- 小陈学js 预解析
- 数据开发面试问题记录
- mfc: 获取打印机列表
热门文章
- 格式化字符串替换2022/8/2am
- root改名字,root重命名
- oracle 中的 CONCAT,substring ,MINUS 用法
- 618查看商品历史价格的方法
- CoreData用法二:NSFetchedResultsController实例操作与讲解
- 缠论 python 量化_【JoinQuant聚宽社区干货】量化学习资料、经典交易策略、Python入门...
- java 打印byte数组内容_java中打印byte数组
- 世界顶级黑客大赛内情首次揭秘:有“连环计”,最后一刻把“韩国队”拉下马...
- 任务管理器被管理员禁用_为什么禁用任务管理器?
- SQL注入漏洞-绕过