Created
November 22, 2018 16:12
-
-
Save TheRealNoob/6ba34ec323d45360d10915d77288b507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$CountersList = @{ | |
"\Processor Information(*)\% Idle Time" = "Percent_Idle_Time" | |
"\Processor Information(*)\% Interrupt Time" = "Percent_Interrupt_Time" | |
"\Processor Information(*)\Interrupts/sec" = "Interrupts_persec" | |
"\Processor Information(*)\% Privileged Time" = "Percent_Privileged_Time" | |
"\Processor Information(*)\% User Time" = "Percent_User_Time" | |
"\Processor Information(*)\% Processor Time" = "Percent_Processor_Time" | |
"\Processor Information(*)\% DPC Time" = "Percent_DPC_Time" | |
"\LogicalDisk(*)\% Idle Time" = "Percent_Idle_Time" | |
"\LogicalDisk(*)\% Disk Time" = "Percent_Disk_Time" | |
"\LogicalDisk(*)\% Disk Read Time" = "Percent_Disk_Read_Time" | |
"\LogicalDisk(*)\% Disk Write Time" = "Percent_Disk_Write_Time" | |
"\LogicalDisk(*)\Current Disk Queue Length" = "Current_Disk_Queue_Length" | |
"\LogicalDisk(*)\Avg. Disk Queue Length" = "Avg_Disk_Queue_Length" | |
"\LogicalDisk(*)\% Free Space" = "Percent_Free_Space" | |
"\LogicalDisk(*)\Free Megabytes" = "Free_Megabytes" | |
"\LogicalDisk(*)\Disk Transfers/sec" = "Disk_Transfers_persec" | |
"\LogicalDisk(*)\Disk Reads/sec" = "Disk_Reads_persec" | |
"\LogicalDisk(*)\Disk Writes/sec" = "Disk_Writes_persec" | |
"\LogicalDisk(*)\Disk Bytes/sec" = "Disk_Bytes_persec" | |
"\LogicalDisk(*)\Disk Read Bytes/sec" = "Disk_Read_Bytes_persec" | |
"\LogicalDisk(*)\Disk Write Bytes/sec" = "" | |
"\LogicalDisk(*)\Avg. Disk Bytes/Transfer" = "" | |
"\LogicalDisk(*)\Avg. Disk Bytes/Read" = "" | |
"\LogicalDisk(*)\Avg. Disk Bytes/Write" = "" | |
"\PhysicalDisk(*)\Disk Read Bytes/sec" = "" | |
"\PhysicalDisk(*)\Disk Write Bytes/sec" = "" | |
"\PhysicalDisk(*)\Current Disk Queue Length" = "" | |
"\PhysicalDisk(*)\Disk Reads/sec" = "" | |
"\PhysicalDisk(*)\Disk Writes/sec" = "" | |
"\PhysicalDisk(*)\% Disk Time" = "" | |
"\PhysicalDisk(*)\% Disk Read Time" = "" | |
"\PhysicalDisk(*)\% Disk Write Time" = "" | |
"\PhysicalDisk(*)\Avg. Disk Bytes/Transfer" = "" | |
"\PhysicalDisk(*)\Avg. Disk Bytes/Read" = "" | |
"\PhysicalDisk(*)\Avg. Disk Bytes/Write" = "" | |
"\Network Interface(*)\Bytes Total/sec" = "" | |
"\Network Interface(*)\Bytes Received/sec" = "" | |
"\Network Interface(*)\Bytes Sent/sec" = "" | |
"\Network Interface(*)\Packets/sec" = "" | |
"\Network Interface(*)\Packets Received/sec" = "" | |
"\Network Interface(*)\Packets Sent/sec" = "" | |
"\Network Interface(*)\Packets Received Discarded" = "" | |
"\Network Interface(*)\Packets Outbound Discarded" = "" | |
"\Network Interface(*)\Packets Received Errors" = "" | |
"\Network Interface(*)\Packets Outbound Errors" = "" | |
"\Paging File(*)\% Usage" = "" | |
"\Paging File(*)\% Usage Peak" = "" | |
"\System\Processes" = "" | |
"\System\Threads" = "" | |
"\System\Context Switches/sec" = "" | |
"\System\System Calls/sec" = "" | |
"\System\Processor Queue Length" = "" | |
"\System\System Up Time" = "" | |
"\Memory\Available Bytes" = "" | |
"\Memory\Committed Bytes" = "" | |
"\Memory\Cache Faults/sec" = "" | |
"\Memory\Demand Zero Faults/sec" = "" | |
"\Memory\Page Faults/sec" = "" | |
"\Memory\Pages/sec" = "" | |
"\Memory\Transition Faults/sec" = "" | |
"\Memory\Pool Nonpaged Bytes" = "" | |
"\Memory\Pool Paged Bytes" = "" | |
"\Memory\Standby Cache Reserve Bytes" = "" | |
"\Memory\Standby Cache Normal Priority Bytes" = "" | |
"\Memory\Standby Cache Core Bytes" = "" | |
"\Memory\% Committed Bytes In Use" = "" | |
} | |
$CounterSamples = (Get-Counter -Counter ([array]$CountersList.Keys)).CounterSamples | |
$CounterSamples = $CounterSamples | Select-Object ` | |
@{Name="InstancePath";Expression={$_.Path -Replace("\\\\$($env:COMPUTERNAME)","")}}, ` | |
@{Name="Path";Expression={ | |
if ($_.InstanceName -ne $null) { | |
$_.Path -Replace("\\\\$($env:COMPUTERNAME)","") -Replace ($_.InstanceName,"*") | |
} else { | |
$_.Path -Replace("\\\\$($env:COMPUTERNAME)","") | |
} | |
}, | |
@{Name="Metric";Expression={$CountersList.($_.Path -Replace("\\\\$($env:COMPUTERNAME)","") -Replace ($_.InstanceName,"*"))}}, ` | |
@{Name="Instance";Expression={$_.InstanceName}}, ` | |
@{Name="Value";Expression={$_.CookedValue}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment