Greetings, I am trying to get a list of installed features from a server remotely and outputting to a UDGrid. The script runs without error and produces content that can be seen in the Variable, but is never shows up on the grid. Funny thing is that there is a Next/Previous button that shows up at the bottom of the page. It’[s like the content is there…just invisible.
Here’s the code:
$Page2 = New-UDPage -Name “Features and Software” -Icon windows -Content {
New-UDGrid -Title “Installed Features” -Headers @(“Installed_Features”) -Properties @(“Installed_Features”) -Endpoint { $SFeature | Out-UDGridData } -FontColor Black
I can’t speak as to why this is the case but I had some empty columns and did the following to get it to render the string in a grid, the .ToString() seemed to do it.
DisplayName = $_.DisplayName.ToString().Trim()
Status = $_.Status.ToString()
Tried adding " $SFeature | Select-Object Installed_Features | Out-UDGridData" ?
I have experienced similar issue and had to select the properties I export to the grid.
In general, casting to string is a safer practice than using the .ToString() method, as .ToString() will throw an error if the variable value is $Null.
When trimming is required, throw in a couple parenthesis to override the order of operations.