this is my function
function Write-Log
{
[CmdletBinding()]
Param
(
# Param1 help description
[Parameter(ValueFromPipelineByPropertyName=$true)]
[System.IO.FileInfo]$FileInfo,
[Parameter(ValueFromPipelineByPropertyName=$true)]
[System.IO.DirectoryInfo]
$DirectoryInfo
)
Begin
{
$logfile = "c:\$(get-date -format 'ddmmmmyyyy_hhmmtt').txt"
}
Process
{
$FullName | Out-File -Append -FilePath $logfile
}
End
{
}
}
I want to pass fileinfo object to this function but I get error:
"
Write-Log : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties
do not match any of the parameters that take pipeline input."
Please advice