Running into an issue I can’t really figure out and have tried a few different ways.
See Code below…
Problem: You cannot call a method on a null-valued expression.
So its something to do in my Foreach when creating the dc2Data it throws that error when I step through it with a debugger. But when I run the code below in its own window, not within UD, it populates the variable and creates the chart… I am assuming this is because the Variable is living on the computer I invoked it on and not my host machine?
Hi, you code looks fine fir me.
I can imagine that the property “DC1 Address” is null and you are trying to execute “.Replace()” on that.
Try that code without the replacement, If the error is resolved there is a null value. Just out of my mind a -replace can help (but not sure if you are expecting a null value).
Kr
Good idea. I just commented it out and then my first row in the Grid populated every hostname into 1 row. Seems like its not breaking it apart when i loop through it with the foreach… Will have to figure out another way to separate it into the PSCustom Object
Should work?
I’m questioning wether or not UDGrid supports spaces in property names? If not, try to shorten the names, and add em to the properties param on the grid to match.
Somewhat works haha. It manages to split each line into the Grid with an individual hostname this time but for some reason the “$_.RecordData.IPV4Address.IPAddressToString” still returns a NULL value… But if i run it manually I get a response with a value. which causes the Grid to fail to load.
Not sure why it returns null for the Dashboard but not my individual user running the exact same commands.
But I figured it out a workaround i guess… When retrieving the objects I just did a Select-Object and set an Alias for each property… Something with the RecordData.IPV4Address.IPAddressToString; it did not like when trying to parse it or something… Not it just returns as $_.IPAddress and works fine…
Strange…
But thank you @BoSen29 and @augustin.ziegler for the help and ideas! Always nice to get another pair of eyes on a problem to make sure I am not derp-in’ out on something.