The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

jhammer (5) [Avatar] Offline
#1
Hi,

In section 8.2.2 of the book, there is an example with the following:

PS> dir $profile | get-member ps*

This gives me an error because $profile is undefined. There is no previous mention of defining a $profile variable in the chapter so I was wondering if this was a typo or if I'm missing something else (I want to make sure I'm not missing anything important).

I get similar output to the text if I remove the $profile variable and run:

PS> dir $profile | get-member ps*

But with this I get both FileInfo and DirectoryInfo.

Thank you!

- Joey
jhammer (5) [Avatar] Offline
#2
Re: Synthetic Members example
Hi,

Okay so I've looked at this some more and I misread the error message. The reason this happens is because $profile is your "personal profile" for PowerShell. The problem is that the file doesn't exist on my machine just yet (up to now I had not created it and neither did PowerShell). So trying to get the directory listing of this failed, which is what the error was trying to tell me all along.

I figured this detail out while I was reading the Appendix A and noticed this is where the $profile variable is introduced (see section A 1.4), though it is used in section 8.2.2.

I apologize for any confusion.

- Joey