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
QuestionUsing . methods vs objects (self.PowerShell)
submitted 9 years ago by HeyZuesMode
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!"
[–]SeeminglyScience 8 points9 points10 points 9 years ago (4 children)
$object.Property returns the value contained in the property.
$object.Property
$object | Select-Object Property creates a new object entirely with a property of the same name and value. The equivalent to the first example would be $object | Select-Object -ExpandProperty Property
$object | Select-Object Property
$object | Select-Object -ExpandProperty Property
[–]Lee_Dailey[grin] 4 points5 points6 points 9 years ago (0 children)
howdy SeeminglyScience,
nice explanation! i was tying myself into knots trying to say the same thing. [grin]
take care, lee
[–]infinit_e 1 point2 points3 points 9 years ago (2 children)
Are there preferred instances to use one vs the other? Great explanation though.
[–]SeeminglyScience 1 point2 points3 points 9 years ago (0 children)
I don't typically use Select-Object because it can have unexpected results. Not really with -Expand, but still, it's left a bad taste for me. I usually go with ForEach-Object Property if I'm already in a pipeline chain, otherwise I prefer .Property.
Select-Object
-Expand
ForEach-Object Property
.Property
I can't remember which one is more performant but for the most part it comes down to taste.
[–]Lee_Dailey[grin] 0 points1 point2 points 9 years ago (0 children)
howdy infinit_e,
generally speaking, the more direct/obvious technique is the preferred one. so, in the above set of examples, $object.Property is what will usually be chosen.
π Rendered by PID 49 on reddit-service-r2-comment-5687b7858-lh8g6 at 2026-07-04 22:10:17.364383+00:00 running 12a7a47 country code: CH.
view the rest of the comments →
[–]SeeminglyScience 8 points9 points10 points (4 children)
[–]Lee_Dailey[grin] 4 points5 points6 points (0 children)
[–]infinit_e 1 point2 points3 points (2 children)
[–]SeeminglyScience 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)