Get-ChildItem - different results between the usage of -include and -filter

Hello, I’m running the following two command and getting different results:
Get-childitem -Path "C:\" -recurse -include '*.ps1' -EA 0 >>> it returns only files with names ending with “.ps1” in total 852
Get-childitem -Path "C:\" -recurse -filter '*.ps1' -EA 0 >>> it returns files with names ending with “.ps1” but aslo files ending with “.ps1xml” in total 1222 files (852 .ps1 + 370 .ps1xml)

Why when I’m using the -filter parameter it also matches files ending in “.ps1xml” ?

Catalin Filip

Looks like a bug and is fixed in latest version of PowerShell.

1 Like

Thank you very much for the tip!