I think this is a common trap (at least for me). You have to specify
in the function that the block of code is process part:
function global:sign {
param([Parameter(mandatory=$true,ValueFromPipeline=$true)]
[System.io.fileinfo[]]$fileList)
process {
foreach ( $file in $fileList ) {
set-authenticodesignature -filepath $file -certificate ( ls cert:
\CurrentUser\my -codesigning );
}
}
}
On Feb 23, 9:51*am, ryan <r...@newsgroup> wrote:
> hello,
>
> i have a script to sign file. but it will only sign the last file passed
> down. (ls *.ps1 | sign) ps didn't show any syntax error. could you help
> point it out?
>
> function global:sign {
>
> * *param(
> [Parameter(mandatory=$true,ValueFromPipeline=$true)][System.io.fileinfo[]]$fileList
> );
>
> * *foreach ( $file in $fileList ) {
> * * * set-authenticodesignature -filepath $file -certificate ( ls
> cert:\CurrentUser\my -codesigning );
> * *}
>
> }