- <#
- .SYNOPSIS
- This script gets and displays perf counters for DHCP
- .DESCRIPTION
- This script uses the Get-Counter cmdlet to get all
- the counters for DHCP. The function does this for one
- DHCP server at a time.
- .NOTES
- File Name : Show-.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- C:\Foo> Get-DHCPPerformanceCounters -comp dhcp2
- Performance counters for: dhcp2
- \\dhcp1\dhcp server\failover: bndupd dropped. 0
- \\dhcp1\dhcp server\failover: transitions to recover state. 8
- \\dhcp1\dhcp server\failover: transitions to partner-down state. 0
- \\dhcp1\dhcp server\failover: transitions to communication-interrupted state. 9
- \\dhcp1\dhcp server\failover: bndupd pending in outbound queue. 0
- \\dhcp1\dhcp server\failover: bndack received/sec. 0
- \\dhcp1\dhcp server\failover: bndack sent/sec. 0
- \\dhcp1\dhcp server\failover: bndupd received/sec. 0
- \\dhcp1\dhcp server\failover: bndupd sent/sec. 0
- \\dhcp1\dhcp server\denied due to nonmatch. 0
- \\dhcp1\dhcp server\denied due to match. 0
- \\dhcp1\dhcp server\offer queue length 0
- \\dhcp1\dhcp server\releases/sec 0
- \\dhcp1\dhcp server\declines/sec 0
- \\dhcp1\dhcp server\nacks/sec 0
- \\dhcp1\dhcp server\acks/sec 0
- \\dhcp1\dhcp server\informs/sec 0
- \\dhcp1\dhcp server\requests/sec 0
- \\dhcp1\dhcp server\offers/sec 0
- \\dhcp1\dhcp server\discovers/sec 0
- \\dhcp1\dhcp server\conflict check queue length 0
- \\dhcp1\dhcp server\active queue length 0
- \\dhcp1\dhcp server\milliseconds per packet (avg). 28
- \\dhcp1\dhcp server\packets expired/sec 0
- \\dhcp1\dhcp server\duplicates dropped/sec 0
- #>
- # Get-DHCPPerformanceCounters function
- Function Get-DHCPPerformanceCounters {
- Param (
- $comp = 'localhost')
- # Get DHCP Counters
- $set = get-counter -listset "DHCP Server"
- $ctrs = $set.counter
- " Performance counters for: {0}" -f $comp
- # For each counter, get the sample
- foreach ($ctr in $ctrs) {
- $sample = (get-counter $ctr).countersamples
- "{0,-78} {1,10}" -f $sample.path, $sample.cookedvalue
- }
- }
- # Now test it
- Get-DHCPPerformanceCounters -comp dhcp1
- Get-DHCPPerformanceCounters -comp dhcp2
Technorati Tags: DHCP
No comments:
Post a Comment