PowerShell Get-Childitem -Include

PowerShell GCI -Include Parameter

My advice is to avoid the -Include parameter. If you want to filter the output then use the -Filter parameter! The problem with -Include is that it doesn’t do what you think. In the case of Get-ChildItem, -Include operates on the path and not on the individual filenames. To overcome this limitation you need a wildcard* or the -Recurse parameter.

I like the Permissions Monitor because it enables me to see WHO has permissions to do WHAT at a glance. When you launch this tool it analyzes a users effective NTFS permissions for a specific file or folder, and takes into account network share access, then displays the results in a nifty desktop dashboard!

Think of all the frustration that this free SolarWinds utility saves when you are troubleshooting authorization problems for user’s access to a resource. Give this permissions monitor a try – it’s free!

Solution C: Ditch -Include; and substitute a parameter called -Filter.

Clear-Host Get-ChildItem -Path $env:SystemRoot\System32 -Filter *.exe

Eureka: You get a neat list of all the executables in the System32. No unwanted files from the folders lower down the tree.

Conclusion: Now you know why -Include is my least favorite PowerShell parameter, wherever possible employ the -Filter instead. I confess that I have deliberately not shown -Include in its best possible light, nevertheless it always disappoints me whenever I give it a try.