Noob Question My apologies

Welcome Forums General PowerShell Q&A Noob Question My apologies

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 week, 3 days ago.

  • Author
    Posts
  • #113689

    Participant
    Points: 0
    Rank: Member

    My apologies for a noob question. I am just getting into powershell and reading Lean Powershell In A Month of Lunches. In Chapter 9 I am learning Hash Tables which I understand. There is a part that it says to go look at Help Select -Full. There is a one-liner that I understand all the way up until the end.

    Get-Process | Select-Object -Property ProcessName,@{Name="Start Day"; Expression = {$_.StartTime.DayOfWeek}}

    How and where do they get DayOfWeek? I know where StartTime comes from and I am assuming that DayOfWeek is an object of StartTime? But how do I get that? Again sorry for a noob question.

    Rich

  • #113714

    Keymaster
    Points: 1
    Rank: Member

    Please don't apologize ;). Everyone starts someplace.

    DayOfWeek is a property of a DateTime object, which is what the StartTime property is. If you did:

    Get-Process | Select -Expand StartTime | Get-Member

    You'd see the properties available. You could also:

    Get-Date | Get-Member

    Which would show you basically the same set of information.

    • #113717

      Participant
      Points: 0
      Rank: Member

      Thank you Don for the explanation. Just wasn't sure where to look. Just didn't know to use Get-Date from Select-Objects help file on that one snippet. Again much appreciated now to continue reading your book. Thank you for all your efforts to the community.

      Rich

  • #113720

    Participant
    Points: 0
    Rank: Member

    I have been putting together some learning resources for PowerShell, written in PowerShell to give you a good level of immersion whilst explaining quite a bit along the way.

    https://www.github.com/vexx32/pskoans

    For this sort of stuff, specifically, I would highly recommend looking over the AboutDiscovery koans; that covers fairly extensively the kinds of things you can discover with some strategic usage of the discovery commands built into PowerShell. 🙂

     

    • #113722

      Participant
      Points: 0
      Rank: Member

      Thanks Joel!! I will definitely look this over.

      Rich

You must be logged in to reply to this topic.