# In PS CTP2v3, .NET access to IP statistics is non-existent. There are no static members
# for the interface statistics yet, although there are non static members:
[System.Net.NetworkInformation.IcmpV4Statistics].getmembers() | %{$_.name}
[System.Net.NetworkInformation.IPGlobalStatistics].getmembers() | %{$_.name}
# This means network data has to come from WMI or netsh:
$computer = "LocalHost"
$namespace = "root\CIMV2"
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_TCP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_UDP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_IP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfRawData_Tcpip_TCP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfRawData_Tcpip_UDP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfRawData_Tcpip_IP -computername $computer -namespace $namespace
Get-WmiObject -class Win32_PerfRawData_Tcpip_NetworkInterface -computername $computer -namespace $namespace
netsh interface ip show
netsh interface ip show ipstats
netsh interface ip show tcpstats
netsh interface ip show interface
$computer = "LocalHost"
$namespace = "root\CIMV2"
$Tcpip_TCP = Get-WmiObject -class Win32_PerfFormattedData_Tcpip_TCP -computername $computer -namespace $namespace
$Tcpip_TCP | Select ConnectionFailures,ConnectionsActive,ConnectionsEstablished,ConnectionsPassive,ConnectionsReset
$computer = "LocalHost"
$namespace = "root\CIMV2"
$Tcpip_NI = Get-WmiObject -class Win32_PerfRawData_Tcpip_NetworkInterface -computername $computer -namespace $namespace
$Tcpip_NI | Select BytesReceivedPersec,BytesSentPersec,BytesTotalPersec
$netsh_interface_stats = netsh interface ip show interface
$netsh_interface_stats | Select-string "In Octets"
$netsh_interface_stats | Select-string "Out Octets"
No comments:
Post a Comment