# encoding: ascii
# api: powershell
# title: Add-Counter
# description: Function Add-Counter (adds Count NoteProperty to pipeline input to keep a running row count for display); sample usage:
# version: 0.1
# type: function
# author: BillBarry
# license: CC0
# function: Add-Counter
# x-poshcode-id: 5016
# x-archived: 2014-03-30T06:46:50
# x-published: 2014-03-24T20:00:00
#
# Get-Service | Add-Counter | FT Count,Name,Status -AutoSize
#
Function Add-Counter {
[CmdletBinding()]
Param(
[parameter(Mandatory=$true, ValueFromPipeline=$true)] $input,
[string] $Name='Count'
)
BEGIN { $i = 0;}
PROCESS {
$i++;
return Add-Member -InputObject $_ -MemberType NoteProperty -Name $Name -Value $i -PassThru
}
}