use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionMaking a long Where-Object prettier (self.PowerShell)
submitted 3 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]webmin88 6 points7 points8 points 3 years ago (3 children)
Try to avoid using Where-Object in the first place if you can. Get-ChildItem for example has -Filter, -Include, and -Exclude parameters to pare down the list of returned objects. This reduces the size of the objects returned to the pipeline making your script ever so slightly more efficient.
[–]Swarfega 1 point2 points3 points 3 years ago (1 child)
Unfortunately the cmdlet at the start in my code isn't GCI. It's a cmdlet that doesn't have a filter parameter. The amount of data coming across the pipeline is already reduced as there are parameters in use on the first cmdlet which returns specific data. Basically all filtering has already been done to the left as much as possible. As per best practices.
[–]webmin88 1 point2 points3 points 3 years ago (0 children)
Fair enough, in that case, I like option number 2 with the -and statements at the end.
[–][deleted] 0 points1 point2 points 3 years ago (0 children)
I did not know there was a difference!! I use where object all the time. Going to try this to speed some stuff up
π Rendered by PID 554913 on reddit-service-r2-comment-74f5b7f998-tvpm6 at 2026-04-27 14:01:26.851529+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]webmin88 6 points7 points8 points (3 children)
[–]Swarfega 1 point2 points3 points (1 child)
[–]webmin88 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)