<#
.SYNOPSIS
Reads a CSV file and filters it.
.DESCRIPTION
The ReadUsersCsv.ps1 script reads a CSV file and filters it on the 'UserName' column.
.PARAMETER Path
Specifies the path of the CSV input file.
.INPUTS
None. You cannot pipe objects to ReadUsersCsv.ps1.
.OUTPUTS
None. ReadUsersCsv.ps1 does not generate any output.
.EXAMPLE
C:\PS> .\ReadUsersCsv.ps1 -Path C:\Temp\Users.csv -UserName j.doe
#>
Param
(
[Parameter(Mandatory=$true,ValueFromPipeline=$false)]
[System.String]
$Path,
[Parameter(Mandatory=$true,ValueFromPipeline=$false)]
[System.String]
$UserName
)
Import-Csv -Path $Path | Where-Object -FilterScript {$_.UserName -eq $UserName}
The above script documentation can be displayed by running Get-Help -Name ReadUsersCsv.ps1 -Full
: