The difficulty comes when you begin using the WMIC command for real work. In most cases, you??™ll
need to use a Structured Query Language (SQL)-like syntax that tells WMIC precisely what element
of your system to work with. Given that WMIC makes your system look like a hierarchical
database, the use of a SQL-like syntax works well. The actual name for this syntax is WMI Query
46 CHAPTER 3 PERFORMING ESSENTIAL MAINTENANCE TASKS
Language (WQI) and you can find detailed information about it at http://msdn2.microsoft
.com/en-us/library/aa394552.aspx. As an example of WQI at work, the WMIC ComputerSystem
Where Name="%COMPUTERNAME%" Call Rename Name="NewName" command defines a new name
for your computer. The rest of this section takes this command apart.
The term ComputerSystem is an alias. It references the computer system elements of WMI. You
need an alias to locate the particular branch of the database that contains the element that you want
to work with.
The Where clause tells WMIC which property to access within the alias. In this case, the name of
the property must match the %COMPUTERNAME% expansion variable. This system environment variable
appears with every copy of Windows and it always contains the name of the local system.
Pages:
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177