Connection Time of Windows Ethernet Link in Powershell

Posted on

QUESTION :

In the old-world “adapter properties” screen of Windows 10 there is a Status command which shows the traffic on the (Ether)Net adapter and how long the link is up. I need this time information in a Powershell script, has anybody an idea how to get that?

Unlike the adapter creation, install or reset time the timestamp or duration should mark when the last time a positive link state was reached (to see the last time a physical network unplug was healed).

I did not see it in Get-NetAdapter nor netsh nor Get-WmiObject -Class win32_networkadapter

Screenshot Adapter Status

ANSWER :

Use instead the
Get-CimInstance command.

An example for getting the up-time is the following PowerShell command:

Get-CimInstance Win32_networkadapter | where {$_.NetEnabled -eq $true} | select Name, @{N="Uptime"; E={(Get-Date) - $_.TimeOfLastReset}} |sort Name | fl

Leave a Reply

Your email address will not be published. Required fields are marked *