Nevermind, I just need to put the "|" inside. ,ie
dir -r $dir | ?{$_.mode -match "d"}|%{$_.get_fullname()} |%{cacls $_|%{
$_ = $_.replace("(OI)","")
$_
}
}
Thanks,
"Frank" wrote:
Quote:
> Hi,
>
> I am trying to list out perms recursively for a directory via cacls and I
> need to remove some strings. Is there a limit to the number of pipes
> allowed? I wouldn't think so. Here is the script:
>
> $dir = read-host -prompt "Enter starting directory for cacls list "
> dir -r $dir | ?{$_.mode -match "d"}|%{$_.get_fullname()} |%{cacls $_}|%{
> $_ = $_.replace("(OI)","")
> $_
> }
>
> When I do this interactively,it works:
>
> cacls d:\test | %{$_.replace("(OI)","")}