Update StackMonkey_Beta.ps1

This commit is contained in:
2025-07-02 18:05:09 -04:00
parent 97666080a8
commit 20d398c57c

View File

@@ -1,11 +1,13 @@
#region changes to be done #region changes to be done
<# # seems like the command IS running without UI
# & ([ScriptBlock]::Create( (iwr 'https://sm.svstools.com').Content )) -N8nPassword 'Tndmeeisdwge!' -FetchSitesOnly
& ([ScriptBlock]::Create((iwr 'https://sm.svstools.com' -UseBasicParsing).Content )) -N8nPassword 'pwd' -SiteUID '' -SiteName '' -InstallRMM -PushSiteVars -SaveCopy # and iwr sm.svstools.com | iex lauched the UI as intended
Need to pass the N8N variables to the "install-dattormm" in the toolkit
#> # need to test
# Write-Host "🛠️ SAMY - Script Automation Monkey (Yeah!)" -ForegroundColor Cyan
#endregion changes to be done #endregion changes to be done
@@ -427,6 +429,8 @@ $subHtml
#endregion Build-Checkboxes #endregion Build-Checkboxes
#region Get-ModuleVersionHtml
### Get SVSMSP module version to display in the UI ### Get SVSMSP module version to display in the UI
function Get-ModuleVersionHtml { function Get-ModuleVersionHtml {
$mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1 $mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1
@@ -436,6 +440,9 @@ $subHtml
return "<div style='color:#f66;'>SVSMSP_Module not found</div>" return "<div style='color:#f66;'>SVSMSP_Module not found</div>"
} }
#endregion Get-ModuleVersionHtml
#region Strat-Server
# Starts the HTTP listener loop # Starts the HTTP listener loop
function Start-Server { function Start-Server {
# make it accessible to Dispatch-Request # make it accessible to Dispatch-Request
@@ -459,6 +466,7 @@ $subHtml
Write-LogHybrid "Listener closed." "Info" "Server" Write-LogHybrid "Listener closed." "Info" "Server"
} }
} }
#endregion Strat-Server
#region UIHtml #region UIHtml
function Get-UIHtml { function Get-UIHtml {
@@ -1348,6 +1356,8 @@ $script
#endregion Handler Stubs #endregion Handler Stubs
#region Dispatch-Request
# Sends the HTML for a given page or invokes a task handler # Sends the HTML for a given page or invokes a task handler
function Dispatch-Request { function Dispatch-Request {
param($Context) param($Context)
@@ -1389,6 +1399,7 @@ $script
$Context.Response.StatusCode = 404 $Context.Response.StatusCode = 404
Respond-Text $Context '404 - Not Found' Respond-Text $Context '404 - Not Found'
} }
#endregion Dispatch-Request
#region EntryPoint: Define Invoke-ScriptMonkey #region EntryPoint: Define Invoke-ScriptMonkey
@@ -1474,9 +1485,6 @@ $script
} }
#endregion EntryPoint: Define Invoke-ScriptMonkey #endregion EntryPoint: Define Invoke-ScriptMonkey
Write-Host "🛠️ SAMY - Script Automation Monkey (Yeah!)" -ForegroundColor Cyan
Write-Host "ParameterSetName: $($PSCmdlet.ParameterSetName)" -ForegroundColor Yellow
#region — guarantee NuGet provider is present without prompting #region — guarantee NuGet provider is present without prompting
# ─── Top of script ─── # ─── Top of script ───
@@ -1524,10 +1532,6 @@ $script
#endregion #endregion
# If we got here, it's the UI set—launch browser + listener:
# ——— UI fallback starts here ———
Write-LogHybrid "Launching UI" Info Startup
#region Install-DattoRMM-Helper #region Install-DattoRMM-Helper
function Install-DattoRMM-Helper { function Install-DattoRMM-Helper {
param ( param (