Update StackMonkey.ps1
This commit is contained in:
@@ -1825,7 +1825,7 @@ function Install-DattoRMM {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
'UI' {
|
'UI' {
|
||||||
Write-LogHybrid "Starting ScriptMonkey UI on http://localhost:$Port/" Info Startup
|
Write-LogHybrid "Starting ScriptMonkey UI on http://localhost:$Port/" Info Startup
|
||||||
try {
|
try {
|
||||||
@@ -1841,6 +1841,34 @@ function Install-DattoRMM {
|
|||||||
return
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user