Update StackMonkey.ps1
This commit is contained in:
@@ -1825,7 +1825,7 @@ function Install-DattoRMM {
|
||||
|
||||
}
|
||||
|
||||
|
||||
<#
|
||||
'UI' {
|
||||
Write-LogHybrid "Starting ScriptMonkey UI on http://localhost:$Port/" Info Startup
|
||||
try {
|
||||
@@ -1841,7 +1841,35 @@ function Install-DattoRMM {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
#>
|
||||
|
||||
'UI' {
|
||||
$url = "http://localhost:$Port/"
|
||||
Write-LogHybrid "Starting ScriptMonkey UI on $url" Info Startup
|
||||
|
||||
# Open the UI in a separate PowerShell job so Start-Server can block safely.
|
||||
try {
|
||||
Start-Job -Name 'OpenScriptMonkeyUI' -ScriptBlock {
|
||||
param($u)
|
||||
Start-Sleep -Milliseconds 300
|
||||
try {
|
||||
if (Get-Command -Name 'msedge.exe' -ErrorAction SilentlyContinue) {
|
||||
Start-Process -FilePath 'msedge.exe' -ArgumentList "--app=$u"
|
||||
} else {
|
||||
Start-Process -FilePath $u
|
||||
}
|
||||
} catch { }
|
||||
} -ArgumentList $url | Out-Null
|
||||
} catch {
|
||||
Write-LogHybrid "Failed to schedule browser launch: $($_.Exception.Message)" Warning Startup -LogToEvent
|
||||
}
|
||||
|
||||
# Now start the blocking listener loop
|
||||
Start-Server
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion EntryPoint: Define Invoke-ScriptMonkey
|
||||
|
||||
Reference in New Issue
Block a user