<# .SYNOPSIS Does something with paths supplied via pipeline. .PARAMETER Path Specifies a path to one or more locations. Wildcards are permitted. The default location is the current directory. .LINK Thanks: https://stackoverflow.com/a/30897912/10450299 #> # Breifly introduce the current running script. Write-Host "`n" ($MyInvocation.ScriptName) # Get-Help wont work if script starts with function... Write-Host (Get-Help $PSCommandPath).Synopsis -ForegroundColor DarkGray Function Test-PipelineInput { [CmdletBinding()] param( [Parameter( ValueFromPipeline, ValueFromPipelineByPropertyName )] [PSDefaultValue(Help = "Description for default value.")] [SupportsWildcards()] [string[]]$Path = $PWD ) PROCESS { foreach ($Item in $Path) { $Item = Get-Item $Item Write-Host "Item: $Item" } } } # Run the Test-Functions Test-PipelineInput