Mis-spelling in Powershell

ErrorThis was spectacularly incompetent even by my high standards of incompetence.

It illustrates that if you spell the name of a column incorrectly in Powershell, you don’t get an error, you just get a null column

get-wmiobject -class win32_operatingsystem -computer rdm016 |
select __Server, ServicePackMajorVerstion

And got:

__SERVER                             ServicePackMajorVerstion
--------                             ------------------------

I thought that no service packs had been applied. This, as more attentive readers will have spotted, was not the case. The null under ServicePackMajorVerstion is because you don’t spell ‘version’ with a ‘t’. Two learnings from this:

  • one should test one’s code
  • if you put something invalid in a ‘select’ list in Powershell it won’t necessarily error