Page Navigation in IIS

I’m trying to load a dashboard in IIS and have other pages available like the test dashboard (poshud) . But after setting the main dashboard.ps1 file to the below code the IIS server fails to start.

$HomePage = .(Join-Path $PSScriptRoot "pages\home.ps1")
$Onboarding = .(Join-Path $PSScriptRoot "pages\onboarding.ps1")

Start-UDDashboard -Wait -Dashboard(
    New-UDDashboard -Title "New Dashboard" -Pages @(
        $Home,
        $Onboarding
    )          
)

I tried it with the -Content{} switch on the Start-UDDashboard command as well and the IIS server still failed to start. After looking back at the Documentation it seems that the -Wait and -Dashboard switch is required for hosting in IIS. Is it currently possible to have pages when hosting with IIS?

$Home is a Powershell “automatic variable”, see all the variables with:

get-help about_Automatic_Variables

your code should work like this:

$HomePage = .(Join-Path $PSScriptRoot "pages\home.ps1")
$Onboarding = .(Join-Path $PSScriptRoot "pages\onboarding.ps1")

Start-UDDashboard -Wait -Dashboard(
    New-UDDashboard -Title "New Dashboard" -Pages @(
        $HomePage,
        $Onboarding
    )          
)
1 Like

Ahhh I see, I was a bit tired yesterday this makes sense now looking at it. Thank you for the reply!

After trying your code IIS still fails to load. I’m going to keep messing with it and see if I can get it to work.

After messing around I was able to get IIS to load. With this code:

$Pages = @()
$Pages += . (Join-Path $PSScriptRoot "pages\home.ps1")

Get-ChildItem (Join-Path $PSScriptRoot "pages") -Exclude "home.ps1" | ForEach-Object {
    $Pages += . $_.FullName
}

Start-UDDashboard -Wait -Dashboard(
    New-UDDashboard -Title "Dashboard Title" -Pages $Pages -FontIconStyle FontAwesome           
)

But I still do not see the pop-out icon (Three White Bars) for page navigation next to the title. Is that part of the New-UDPageHeader function that is built in the poshud example dashboard.ps1 file?

Update: I figured it out… I had one of my pages -Icon switches set to font awesome icon that wasn’t being recognized. Is there a list of the Icons available within the cmdlet anywhere??

Dot sourcing your pages will work. (Notice the space after the dot)

$HomePage = . (Join-Path $PSScriptRoot "pages\home.ps1")
$Onboarding= . (Join-Path $PSScriptRoot "pages\onboarding.ps1")

Start-UDDashboard -Wait -Dashboard(
    New-UDDashboard -Title "New Dashboard" -Pages @($Home, $Onboarding)      
)
2 Likes