开发者社区> 长征2号> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

WMI中相关的操作说明execquery 或者是instancesof

简介:
+关注继续查看

原文地址:http://include.wutils.com/wmi/ROOT%5Ccimv2/Win32_DiskQuota.html

Win32_DiskQuota - VB Script code samples

Get instance of WMI class using GetObject

Short VBS code - get a single specified instance of Win32_DiskQuota class or get a default unnamed instance (singleton) of the class, using one single command GetObject with exact path of the wmi object.

'http://wutils.com/wmi/
Dim wmiObject
Set wmiObject = GetObject( _
 "WINMGMTS:\\.\ROOT\cimv2:" + _
 "Win32_DiskQuota.QuotaVolume=""Path to Win32_LogicalDisk"",User=""Path to Win32_Account""")
Wscript.Echo wmiObject.DiskSpaceUsed 'or other property name, see table bellow

Alternative codes

SWbemServices.Get

Quickest and most efficient VB Script code to get a single instance by a key - SWbemServices.Get

'http://wutils.com/wmi/
Dim oWMI, Instance

'Get base WMI object, "." means computer name (local)
Set oWMI = GetObject("WINMGMTS:\\.\ROOT\cimv2")

Do
  'Get the instance of Win32_DiskQuota 
  Set Instance = oWMI.Get("Win32_DiskQuota.QuotaVolume=""Path to Win32_LogicalDisk"",User=""Path to Win32_Account""")
                    
  'Do something with the instance
  Wscript.Echo Instance.DiskSpaceUsed 'or other property name

  'Wait for some time to get next value
  Wscript.Sleep 1000
Loop While True  
  
WMI query - sample windows WQL

Get a specified instance of Win32_DiskQuota by key, get a default unnamed instance (singleton) of the class or list instances of the class by wmi query using this VB Script.

'http://wutils.com/wmi/
Dim oWMI, WQL, Instances, Instance

'Get base WMI object, "." means computer name (local)
Set oWMI = GetObject("WINMGMTS:\\.\ROOT\cimv2")

'Create a WMI query text 
WQL = "Select * from Win32_DiskQuota"

'Get instances of Win32_DiskQuota 
Set Instances = oWMI.ExecQuery(WQL)
                    
'Enumerate instances  
For Each Instance In Instances 
  'Do something with the instance
  Wscript.Echo Instance.DiskSpaceUsed 'or other property name
Next 'Instance
InstancesOf

List of all instances, wmi class Win32_DiskQuota.

'http://wutils.com/wmi/
Dim oWMI, Instances, Instance

'Get base WMI object, "." means computer name (local)
Set oWMI = GetObject("WINMGMTS:\\.\ROOT\cimv2")

'Get instances of Win32_DiskQuota 
Set Instances = oWMI.InstancesOf("Win32_DiskQuota")


'Enumerate instances  
For Each Instance In Instances 
  'Do something with the instance
  Wscript.Echo Instance.DiskSpaceUsed 'or other property name
Next 'Instance
WMI remote scripting - Locator, Connect

Get WMI management object using SWbemLocator.ConnectServer method. You can connect to a remote computer and specify Username/Password for the WMI connection.

'http://wutils.com/wmi/
Dim Locator, oWMI, WQL, Instances, Instance

'Create Locator object
Set Locator = CreateObject("WbemScripting.SWbemLocator")

'Get base WMI object
Set oWMI = Locator.ConnectServer("MachineName", "ROOT\cimv2", "MachineName\administrator", "Password")
 
'.... continue using oWMI object

Win32_DiskQuota properties

>>

Name
CIMType
IsArray
IsLocal
Origin
read
Units
write
key
ValueMap
Qualifiers

DiskSpaceUsed
21,uint64
NO
YES
Win32_DiskQuota
True
"Bytes"
-

Limit
21,uint64
NO
YES
Win32_DiskQuota
True
"Bytes"
True
-

key

QuotaVolume
102,ref:Win32_LogicalDisk
NO
YES
Win32_DiskQuota
True
True
-

Status
19,uint32
NO
YES
Win32_DiskQuota
True
Array["0","1","2"]
-

key

User
102,ref:Win32_Account
NO
YES
Win32_DiskQuota
True
True
-

WarningLimit
21,uint64
NO
YES
Win32_DiskQuota
True
"Bytes"
True
-

Win32_DiskQuota derivation

Win32_DiskQuota is top level class. See other top classes or no derived classes.

Sample of Instances (Win 2003 Server)

Number of instances: 9999, Key Names:QuotaVolume,User

Win32_DiskQuota Qualifiers

>>

Name
Value
ToInstance
ToSubclass
Overridable
Amended
Local

Association
True
YES
YES
NO
NO
YES

CreateBy
"PutInstance"
NO
NO
YES
NO
YES

DeleteBy
"DeleteInstance"
NO
NO
YES
NO
YES

dynamic
True
YES
NO
YES
NO
YES

Locale
&1033
YES
NO
YES
NO
YES

provider
"DskQuotaProvider"
YES
NO
YES
NO
YES

SupportsCreate
True
NO
NO
YES
NO
YES

SupportsDelete
True
NO
NO
YES
NO
YES

SupportsUpdate
True
NO
NO
YES
NO
YES

UUID
"B94560CA-41CC-4FB5-BD56-282329DA41DA"
YES
NO
YES
NO
YES

Win32_DiskQuota System properties

>>

Name
Value
Origin
CimType
Local
Array

__PATH
"\\TRIPLE\ROOT\cimv2:Win32_DiskQuota"
___SYSTEM
8
False
False

__NAMESPACE
"ROOT\cimv2"
___SYSTEM
8
False
False

__SERVER
"TRIPLE"
___SYSTEM
8
False
False

__DERIVATION
Array[]
___SYSTEM
8
False
True

__PROPERTY_COUNT
&6
___SYSTEM
3
False
False

__RELPATH
"Win32_DiskQuota"
___SYSTEM
8
False
False

__DYNASTY
"Win32_DiskQuota"
___SYSTEM
8
False
False

__SUPERCLASS
___SYSTEM
8
False
False

__CLASS
"Win32_DiskQuota"
___SYSTEM
8
False
False

__GENUS
&1
___SYSTEM
3
False
False

http://include.wutils.com/wmi/ - WMI reference for windows server. Quick VBScript and c# code samples.


本文转自hcy's workbench博客园博客,原文链接:http://www.cnblogs.com/alterhu/archive/2012/04/09/2439064.html,如需转载请自行联系原作者。

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
SAP UI5 jQuery.sap.includeStyleSheet
Created by Wang, Jerry, last modified on May 21, 2015
31 0
jquery weui地区选择器数据自定义报错'sub' of undefined,修改源码解决
jquery weui地区选择器数据自定义报错'sub' of undefined,修改源码解决 报错原因是数据格式错误,或者设置默认选择的地区与数据不一致 <div class="weui-cell"> <div class="weui-cell__hd">居住地:</div> .
1806 0
论文他引次数及ESI高被引论文查询方法
https://yunpan.cn/cS67Z9UEDvc2b 访问密码 f078
1255 0
spring3 的restful API RequestMapping介绍
原文链接:http://www.javaarch.net/jiagoushi/694.htm spring3 的restful API RequestMapping介绍 在spring mvc中 @RequestMapping是把web请求映射到controller的方法上。
1085 0
jquery之on()绑定事件和off()解除绑定事件
off()函数用于移除元素上绑定的一个或多个事件的事件处理函数。 off()函数主要用于解除由on()函数绑定的事件处理函数。 该函数属于jQuery对象(实例)。 语法 jQuery 1.7 新增该函数。
1045 0
Wix学习整理(3)——关于Windows Installer和MSI
原文:Wix学习整理(3)——关于Windows Installer和MSI 关于Windows Installer Windows Installer是微软Windows操作系统自带的一个软件安装和配置服务,其实现了软件安装的业务逻辑:如何安装软件?如何修改注册表键值?如何创建快捷方式?如何操作网站目录或注册服务?等等。
1027 0
+关注
1703
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载