Writing the Query
You've seen the whole associated class thing in action, but I want to start fresh with a new example and walk you through the entire query- and script-creation process. In the last chapter, I showed you how to set all the network adapters on a computer to use DHCP. In this chapter, I want to be more specific, and only modify the properties of a specific network adapter within the computer. More specifically, I want to
Read a list of computer names from a text file Connect to WMI on each computer and locate the network adapter named "Local Area Connection" Ensure that each configuration for that adapter is set to use DHCP
It seems like the following query should do what I want.
ASSOCIATORS OF
{Win32_NetworkAdapter.NetConnectionID="Local Area Connection"}
WHERE
RESULTCLASS = Win32_NetworkAdapterConfiguration
That should pull all Win32_NetworkAdapter instances where the NetConnectionID is "Local Area Connection," and then retrieve the associated Win32_NetworkAdapterConfiguration instances.
|