# Querying and filtering MSFT\_NetTCPConnection through WMI with extensions v2

**URL:** <https://community.dynatrace.com/t/querying-and-filtering-msft-nettcpconnection-through-wmi-with-extensions-v2/41546>\
**Category:** Extensions\
**Tags:** wmi, extensions\
**Created:** [September 6, 2023, 10:41pm UTC](https://community.dynatrace.com/t/querying-and-filtering-msft-nettcpconnection-through-wmi-with-extensions-v2/41546 "2023-09-06T22:41:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ben\_davidson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ben_davidson/32/20391_2.png) [@ben\_davidson](https://community.dynatrace.com/u/ben_davidson)\
**Post date:** [December 12, 2023, 4:14pm UTC](https://community.dynatrace.com/t/querying-and-filtering-msft-nettcpconnection-through-wmi-with-extensions-v2/41546/2 "2023-12-12T16:14:32Z")

</div>

You could make the query more manageable by trimming down the query down to just the required properties with something like:

```markup
Get-WmiObject -Query "SELECT Name, OwningProcess, LocalPort FROM MSFT_NetTCPConnection where localport=443" -namespace "root\StandardCIMV2"

```

But unfortunately piping to Group-Object to get a total is not supported by the data source.

Have you looked at the metrics provided by:

```markup
Get-WmiObject -query "SELECT ConnectionsActive, ConnectionsEstablished, ConnectionFailures, ConnectionsPassive, ConnectionsReset FROM Win32_PerfFormattedData_Tcpip_TCPv4"

```

They may not be fine grain enough for what you need though. If they work, they are counter metrics so you need to handle them as such:

```markup
metrics:
    - key: com.dynatrace.extension.host-observability.network.tcp.connections.active
      value: column:ConnectionsActive
      type: count

```

---

_[View the full topic](https://community.dynatrace.com/t/querying-and-filtering-msft-nettcpconnection-through-wmi-with-extensions-v2/41546)._
