I am tracking notes on PowerShell in PS1 files on my git hub repository. You can see all 100 days of code entries on the blog category page.
I actually started the lab questions for chapter 11 today. Actually it was somewhat humorous for the first one: use Get-NetAdapter to display all “non-virutal” network adapters e.g. those with “virtual” set to false.
Well I came with this command:
Get-NetAdapter | Where-Object Virtual -EQ false
No error but it doesn’t give me the right output. Actually it shows me the one virtual adapter. The opposite of what I’m looking for. I think I’d rather have an error. Although looking at the question again it does mention the specially defined $False constant. So if I try the same with that instead:
Get-NetAdapter | Where-Object Virtual -EQ $False
Okay so that one actually works.
But before I re-read the question just now I looked at the answer:
I mean alright that would logically work. But I don’t even see it in the list when I do Get-NetAdapter | gm. Or possibly my eyes are too tired to see that tiny text. In any case I guess I should have paid more attention to that minor detail with the $False. Or for sure it…does make sense just testing against “false” should work too?