New-UDDatagrid and Enviroment PS Version 5.1

Product: PowerShell Universal
Version: 3.3.5

I got this Error if i try to use new-uddatagrid in a Dashboard when using a ps 5.1 env.
didnt find convertto-udobject.
The same code is working within the internal enviroment.
2022-09-24 (2)

PS 5.1 Dashboard:
2022-09-26 (1)

PS7 Dashboard:
2022-09-26

why i see UniversalDashboard Modul as Source?
This Modul isnt needed today…or?

The UniversalDashboard.dll contains this cmdlet. We load it internally and isn’t exported in the manifest.

Can you open a WinPS terminal and make sure you don’t have an older version of UniversalDashboard installed?

Get-Module UniversalDashboard -List

Hi Adam,

i cant see an older version.
2022-09-28 (1)

Can you please try to load the UD module at the top of your dashboard? I tried to reproduce this locally and cannot.

You can try this:

Import-Module (Join-Path (Split-Path (Get-Module Universal).Path -Parent) 'UniversalDashboard.dll')

I have try ist but with no change in behavior.

Could it be a Win 11 22H2 issue?
2022-09-30


Cant find the cmdlet in Dahboard or the local powershell console…

This cmdlet isn’t exported by the Universal module but in the UniversalDashboard.dll library. Can you try loading the UD DLL outside of PSU and run Get-Command?

Import-Module C:\Program Files (x86)\Universal\UniversalDashboard.dll
Get-Command -Module UniversalDashboard

Did not work for PS5.1:
VS Code:


ISE:

and the same commands in VS Code with PS7:

This works for me in the ISE so there must be something different between our environments.

Here’s some version info about where I’m testing this.

PS C:\Users\adamr> $PSVersionTable

Name                           Value                                                                                                                                                                                                 
----                           -----                                                                                                                                                                                                 
PSVersion                      5.1.22621.169                                                                                                                                                                                         
PSEdition                      Desktop                                                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                               
BuildVersion                   10.0.22621.169                                                                                                                                                                                        
CLRVersion                     4.0.30319.42000                                                                                                                                                                                       
WSManStackVersion              3.0                                                                                                                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                   
SerializationVersion           1.1.0.1 


PS C:\Users\adamr> Get-Module

ModuleType Version    Name                                ExportedCommands                                                                                                                                                           
---------- -------    ----                                ----------------                                                                                                                                                           
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}                                                                                                                        
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                                                                         
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}                                                                                  
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                                                                                  
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}                                                                                            
Binary     1.0.0.0    UniversalDashboard                  {ConvertTo-UDObject, ConvertTo-JsonEx, Invoke-UDEndpoint, New-UDElement...}                                                                                                

I do reinstall .net 3.5 Windowsfeature with no change.
I update VS Studio and removed .net2 out of support feature with no change.
i cleaned up my modules foldes…it was time :wink: … with no change.

i dont find the assembly loaded: microsoft.Extensions.ObjectPool

[System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location, GlobalAssemblyCache, IsFullyTrusted | Out-GridView

but i take a look at the error message for Version=5.0.0.0

in PSU Folder contains Version 6. i downloaded Version 5 from nuget.


Left sind Nuget Version 5 Right side PSU Version.

i tried it with V6:

with no success.

then i tried it with version 5:


now that works. there is an error message from add-type but the assembly is loaded.

I take these command into the dashboard at the top:
2022-10-03 top

but i have to load the function and the import module comand another time in the TAB from New-UDTab:

after these changes the datagrid works… i do had this behavior from missing function in some regions of the dashboard. if i encounter these error i do define the missing funtions in these section…but i do not know why and if i have missed someting…

i am a little bit confused :wink:

where could be these typ of changed behavior came from?

Addition:
i do have win 11 Home in german:
2022-10-03 (5)

why my enviroment is missing version 5.0.0.0 if V6 is in the psu folder?
why is the assembly loaded ignoring the errormessage and the load of the module universaldashboard is successfull if V5 is loaded?

The same try with V6:


at the top of the picture is the list of loaded assemblys with “obj” in name. At the bottom the same list after the other commands executed.

V5 and V6 seemed to be loaded…
for me it looks like that the modul universaldashboard is forced to use V5 in my enviroment, witch isnt present…

I have update the Installation to 3.4.0 and now the issue is gone.

I had the same problem.
I was using:
New-PSUEnvironment -Name “Active Directory” -Version “5.1.20348.859” -Path “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -Variables @(‘*’) -PersistentRunspace -StartupScript @(‘.\Environments\Start-AD.ps1’)

I added this to Start-AD.ps1: Import-Module “C:\Program Files (x86)\Universal\UniversalDashboard.dll”