ident
August 28, 2018, 9:47am
1
Hello, I’m new to PS and looking to past an array of items to Get-AuthenticodeSignature.
The exception which is likely obvious to you.
Get-ChildItem : 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.
$files = @("C:\two.exe.exe","C:\one.exe") | Get-ChildItem $files | ForEach-object {Get-AuthenticodeSignature $_}
Thank you
system
August 28, 2018, 9:49am
2
Yep! Try something like this:
$Files = @("C:\one.exe") | Get-AuthenticodeSignature
Should do the trick.
Alternatively, if you want to iterate through all files in a directory, you could still use Get-ChildItem -
$Files = @("C:\OneDir\") | Get-ChildItem -File -Recurse | Get-AuthenticodeSignature
Above reply by James will server you requirement, I just wanted to add one more point.
If you are having PowerShell version < 3.0 , -File switch parameter is not available. You will have to filter using Where-Object cmdlet.
$Files = @("C:\OneDir\") | Get-ChildItem -File -Recurse | Where-Object -FilterScript { -not $_.PSIsContainer} | Get-AuthenticodeSignature
Please ignore above post, there is some issue in code posting as footers became part of post and I’m not able to edit it.
Above reply by James will server you requirement, I just wanted to add one more point.
If you are having PowerShell version < 3.0 , -File switch parameter is not available. You will have to filter using Where-Object cmdlet.
$Files = @("C:\OneDir\") | Get-ChildItem -File -Recurse | Where-Object -FilterScript { -not $_.PSIsContainer} | Get-AuthenticodeSignature
Note: PS version 2.0 is no more recommended and supported by Microsoft due to various securty concerns.