IIS Express with VS Code

Just wondering if anyone’s managed to get the titular products working with their dashboards?

Essentially it’s laziness on my part: I can test/publish the directories without modifying the -port/-wait parameters each time.

If not, I could potentially put some logic in that changes the behaviour if it’s launched on desktop vs server OS.

EDIT: Forgot to mention that I’m using the IIS Express extension for Code.

You can create add to a hashtable with your parameters based on if IIS service is running then “splat” it into the start-dashboard. Below I extracted out just the part of my function for this that changes the parameters based on if IIS is running.

$StartdashboardParams=@{}

if ((get-service W3svc -ea SilentlyContinue | Where-Object { $_.status -eq “running” }))
{
$StartdashboardParams += @{
Wait = $true
}
write-host “IIS running. Will run dashboard with IIS parameters”
}
else
{
write-host “IIS not running. Will run as a service”
$StartdashboardParams += @{
Port = 1000
}
}

Start-UDDashboard -Dashboard $Dashboard @StartdashboardParams

1 Like

Yep, I think that will be the way to go for now - a little neater than simply filtering by OS.