diff --git a/StackMonkey.ps1 b/StackMonkey.ps1 index 11ce810..a1dd6ad 100644 --- a/StackMonkey.ps1 +++ b/StackMonkey.ps1 @@ -1485,16 +1485,16 @@ function Start-Server { #endregion - -# Only launch UI if not in silent mode -if (-not $SilentInstall) { - # open browser on whatever port you've set - # Start-Process "microsoft-edge:http://localhost:$Port" +# Only launch the UI if we’re in the default UI parameter set +if ($PSCmdlet.ParameterSetName -eq 'UI') { + # now that $Port is defined, show it properly: + Write-Host "Starting ScriptMonkey UI on http://localhost:$Port/" -ForegroundColor Cyan Start-Process "msedge.exe" -ArgumentList "--app=http://localhost:$Port" - # now start your server (this will block until you hit Exit in the UI) - Start-Server + Start-Server # this will block until you hit Exit + return } + # At the end of ScriptMonkey.ps1 if ($MyInvocation.ExpectingInput) { Invoke-ScriptMonkey @PSBoundParameters