Help needed here… I was just finishing another function for UK Power Cuts (still dirty as pile of dung I know, but works :P) while I noticed something weird.
Let me show you what I mean on the, picture as we all know it is worth a thousand words:
Unfortunately as I mentioned on the picture – I do not know all these fields. Seems like that “Engineer Expected at” is the only one, but am I sure? No, I am not.
So I do not really know what “properties” of the power cut I may expect. The only solution I found here is to build objects where properties’ names are read in dynamic way. And all was working as expected, until I wanted to print out the list of all power cuts on the screen.
When first processed object will have 3 attributes, and the second one 4, only 3 common attributes will be shown whilst making “format-table” or “select-object *”, so I needed to specify properties.
Seems easy, right? This is how it is done.
I am reading properties of all objects (which are power cuts instances in this case) and add them to the variable $Allproperties. Later, all I do is taking all unique values and put them to the array of strings:
$uni = $Allproperties | select -Unique
Having that array of strings I am preparing the simple output:
$FinalObject | ft $uni
And then I was testing it and got the following…
Visual Studio Console:
Woah looks good! All 5 columns are there despite first processed object is missing one of them.
Same here, all fine.
Where is my 5th column?!?!
So ISE is not displaying a column even when it is provided, it might be because earlier object didn’t have that property, but shouldn’t it be displayed like in other consoles (PS and VSCode)?
Need to figure this out…