Returning Selected Properties of Selected Instances of a Class

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

You also have the option of returning only selected properties of selected classes. To do this, you must:

  • Specify the properties to be returned.
  • Include a WHERE clause to limit the instances returned.

In other words, this type of query combines two query types returning selected properties and returning selected instances explored earlier in this chapter.

For example, this script returns only the name and the state of services that can be paused:

strComputer = "." Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colServices = objSWbemServices.ExecQuery _     ("SELECT Name, State FROM Win32_Service WHERE AcceptPause = True") For Each objService In colServices     Wscript.Echo objService.Name, objService.State Next 

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net