Month of Lunches Help


I recently began going through the Learn Powershell in a month of lunches book. I am currently on chapter 9. I am happy to say that I understand most of the concepts. However, one thing is getting me. While working on lab exercise 3, I have the following question: What determines the values of “l” and “e” that are used in the following:

get-adcomputer -filter * |
Select-Object @{l=‘computername’;e={$}} |

I cannot see where it is dictated what needs to be used or where these letters come from. I tried to substitute a “b” in place of the “l” and get an error… These values seem to be arbitrary as they just accept the values we assign. please explain if possible.

Best Regards,

Eric D. Craven

The “L” and “E” are part of the command syntax. They stand for Label and Expression (which can also be used). They’re hardcoded in by whomever wrote the Select-Object command. They’re also documented in the Full help for Select-Object, and are also usable in the Format- commands.

Those’re actually explained in the book, too, in the bullet list following Figure 9.12.