Noob Question My apologies

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

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.

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

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. :slight_smile:

 

Thanks Joel!! I will definitely look this over.

Rich