过滤WMI查询的结果

时间:2011-08-30 03:12:02

标签: vbscript wmi wmi-query

使用vbscript,如何过滤WMI查询的输出?我想返回除“2”之外的每个本地用户帐户,即“管理员”和“访客”。

Set colUsers = objWMIService.ExecQuery _
    ("select * from Win32_UserAccount where LocalAccount = True")
For Each objUser in colUsers
    WScript.Echo objUser.Name
Next

1 个答案:

答案 0 :(得分:1)

只需将WQL句重写为

即可
objWMIService.ExecQuery("select * from Win32_UserAccount Where Name<>'Administrator' AND Name<>'Visitor' AND LocalAccount=True")