Product: PowerShell Universal
Version: 4.1.5I’m looking to use the Landing Page template but it appears V4 doesn’t have the import feature so i copied the code from here (https://github.com/ironmansoftware/universal-landing-page/blob/main/dashboards/Landing%20Page/Landing%20Page.ps1) and pasted it into a new App.
When i navigate to that app it loads and dynamically displays the apps the user has permission to but it doesn’t appear to be passing the url.
When clicking any of the dashboards i get this error:
Cannot bind argument to parameter 'Url' because it is an empty string.If i add a wait-debugger here and inspect the $_ variable i can see there is a BaseUrl
if ($_.Authenticated -and $_.Role) {
Wait-Debugger
Protect-UDSection -Role $_.Role -Content $Content
}
If i add it on the on-click event though the $_ variable is empty

Has something changed in functionality that now affects the way this should work as this landing page appears to have been put together during 2.X so maybe it needs to reference the URL differently?
Cheers,
Jamie
Recommended Answer
Hi Jamie,
I got this to work by setting the $_ variable into another variable. Something with scoping…
New-UDDashboard -Title 'Home' -Content {
New-UDLayout -Columns 4 -Content {
Get-PSUDashboard -Integrated | Sort-Object Name | ForEach-Object {
if ($_.Name -eq 'Landing Page') {
return
}
if ($_.Authenticated -and $User -eq $null) {
return
}
$Dashboard = $_
$Content = {
New-UDElement -Tag 'div' -Content {
New-UDCard -Title $_.Name -Content {
New-UDStack -Direction column -Spacing 2 -Content {
New-UDTypography $_.Description
New-UDStack -Direction row -Content {
$_.Tag | ForEach-Object {
if ($_ -eq $null) { return }
$Tag = Get-PSUTag -Name $_ -Integrated
New-UDChip -Label $_ -Style @{
borderRadius = "0px"
backgroundColor = $_.Color
color = "white"
}
}
}
}
} -Style @{
minHeight = '172px'
}
} -Attributes @{
style = @{
cursor = "pointer"
}
onClick = {
Invoke-UDRedirect -Native $Dashboard.BaseUrl
}
}
}
if ($_.Authenticated -and $_.Role) {
Protect-UDSection -Role $_.Role -Content $Content
}
else {
& $Content
}
}
}
} -HeaderContent {
if (-not $User) {
New-UDButton -Text 'Login' -OnClick {
Invoke-UDRedirect -Native '/login'
}
}
}Adam Driscoll
PowerShell Expert and Software Architect at Devolutions
Hi Jamie,
I got this to work by setting the $_ variable into another variable. Something with scoping…
New-UDDashboard -Title 'Home' -Content {
New-UDLayout -Columns 4 -Content {
Get-PSUDashboard -Integrated | Sort-Object Name | ForEach-Object {
if ($_.Name -eq 'Landing Page') {
return
}
if ($_.Authenticated -and $User -eq $null) {
return
}
$Dashboard = $_
$Content = {
New-UDElement -Tag 'div' -Content {
New-UDCard -Title $_.Name -Content {
New-UDStack -Direction column -Spacing 2 -Content {
New-UDTypography $_.Description
New-UDStack -Direction row -Content {
$_.Tag | ForEach-Object {
if ($_ -eq $null) { return }
$Tag = Get-PSUTag -Name $_ -Integrated
New-UDChip -Label $_ -Style @{
borderRadius = "0px"
backgroundColor = $_.Color
color = "white"
}
}
}
}
} -Style @{
minHeight = '172px'
}
} -Attributes @{
style = @{
cursor = "pointer"
}
onClick = {
Invoke-UDRedirect -Native $Dashboard.BaseUrl
}
}
}
if ($_.Authenticated -and $_.Role) {
Protect-UDSection -Role $_.Role -Content $Content
}
else {
& $Content
}
}
}
} -HeaderContent {
if (-not $User) {
New-UDButton -Text 'Login' -OnClick {
Invoke-UDRedirect -Native '/login'
}
}
}Adam Driscoll
PowerShell Expert and Software Architect at Devolutions