Cannot validate argument on parameter 'Uri'

Any idea why I keep getting “Cannot validate argument on parameter ‘Uri’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.”?

 function Create-Dashboard ()
{
Count-Licenses | Select Name, Value

$CountLicenses = New-UDEndpointInitialization -Function “Count-Licenses”

$Dashboard = New-UDDashboard -Title "Title" -Content {

New-UDCard -Title “Test” -Endpoint {Count-Licenses}
} -EndpointInitialization $CountLicenses

Start-UDDashboard -Dashboard $Dashboard -Port 10001
} 

Create-Dashboard

My function count-licenses returns Name & Value successfully as shown below"
image

Is this all your code?, whats the ‘Count-Licenses’ function - do you have a -uri parameter on that?
On the error message have you checked to see where the exception is being thrown?
E.g what line/character to try match up to what function this is coming from as you dont have any -uri parameters in your code.

I’d also remove your function ‘create-dashboard’ and start with just doing this in a flat dashboard.ps1 file, I might be wrong but you may be adding complications with scoping when doing it like that, at least for troubleshooting until you get it working.

1 Like

Thanks for replying. I loaded the same powershell script onto another computer and it works as expected. There must be something damaged in my install of Universal Dashboard on my other machine. I’ll try re-installing it.