2013年5月23日 星期四

wmi associator

1:使用WMI object browser點選要開啟的class
2:點選association tab,找出連結兩個class的associator
3:連結成功後即可query對應物件屬性

strComputer = "."
maxlen=0
Set objWMIService = GetObject("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
Set colAdaptersConf = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objAdapterConf In colAdaptersConf
  set ASSOobjItem = objAdapterConf.Associators_("win32_networkAdapterSetting")
  For each objASSOobjItem in ASSOobjItem
     Wscript.Echo objASSOobjItem.NetConnectionID & " : " & objAdapterConf.IPAddress(0)
  Next
Next

沒有留言: