title: Use WMI to retrieve IPv4 address from computer running IPv6
body: <p>I'm using VBScript to retrieve the address of a remote computer using Win32_PingStatus, like so:</p>
  
  <pre><code>dnsServer = "myComputerName"
  Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  colIpQuery = "Select * from Win32_PingStatus where Address='" + dnsServer + "' AND ResolveAddressNames=TRUE"
  Set colIPAddrs = objWMIService.ExecQuery(colIpQuery)
  For Each colIPAddr In colIPAddrs
      If CStr(colIpAddr.StatusCode) = 0 Then
          dnsServerIp = colIpAddr.ProtocolAddress
      End If
  Next
  </code></pre>
  
  <p>The problem here is that if "myComputerName" is running IPv6, <code>colIpAddr.ProtocolAddress</code> will always return only the IPv6 address, but I need the IPv4 address. I can't disable IPv6, skip the IPv6 addresses, etc. Is there any other way to retrieve the IPv4 address without using external methods (ping, powershell, etc.)?</p>