Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8444599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:26:02+00:00 2026-06-10T09:26:02+00:00

In PoweShell 2 we did: Get-ChildItem | ForEach-Object {$_.LastWriteTime} | Sort-Object In Powershell 3

  • 0

In PoweShell 2 we did:

Get-ChildItem | ForEach-Object {$_.LastWriteTime} | Sort-Object  

In Powershell 3 we do:

(Get-ChildItem).LastWriteTime | Sort-Object

But how does it work, i read this blog post on MSDN and they say that its faster because the foreach loop isnt running? So how does it enumerate the properties then ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:26:04+00:00Added an answer on June 10, 2026 at 9:26 am

    PowerShell is doing the hard work for us and it loops over the collection internally. I like to call this “implicit foreach”. Assuming the member you specified is present on each object, if the member you specified is a property, you get back its value. If it’s a method, it invokes the method on the each object.

    In v2, to get all process names you had to take care of looping yourself:

    Get-Process | Foreach-Object {$_.Name}
    

    In v3, the equivalent would be:

    (Get-Process).Name
    

    Same applies to methods. To kill all processes with name starting with note*:

    (Get-Process note*).Kill()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling this powershell command and getting an error. Driving me nuts. Prompt> get-childitem -recurse
Does PowerShell have an equivalent to this command construct from sh (and derivatives): $
I almost have this Powershell script completed but I am stuck at the last
My PowerShell script file is located in C:/this-folder/that-folder/another-folder/powershell-file.ps1 . How do I get a
Powershell provides the New-WebServiceProxy cmdlet which allows for a web service proxy object to
In Powershell I am defining a new PSDrive called test . But when I
PowerShell's type extension facility is neat, but I haven't yet figured out the way
PowerShell provides a simple technique to view the contents of a function, e.g. Get-Content
I'm pretty familiar with PHP, Javascript, etc but I'm new to Powershell. I'm trying
I was listening to the podcast about PowerShell 2.0 that Scott Hanselman did .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.