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:
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 | « Previous | Next » |