removed samy logo
This commit is contained in:
255
StackMonkey.ps1
255
StackMonkey.ps1
@@ -135,6 +135,128 @@
|
|||||||
[Parameter(ParameterSetName='DattoInstall')][switch] $SaveCopy
|
[Parameter(ParameterSetName='DattoInstall')][switch] $SaveCopy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#region ScriptMonkey run silently Entrypoint
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────
|
||||||
|
# 3) MAIN LOGIC (Toolkit vs DattoFetch vs DattoInstall vs UI)
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
|
'Toolkit' {
|
||||||
|
Write-LogHybrid "Toolkit-only mode" Info Startup
|
||||||
|
Install-SVSMSP -InstallToolkit
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
'Cleanup' {
|
||||||
|
Write-LogHybrid "Running Toolkit cleanup mode" Info Startup
|
||||||
|
Install-SVSMSP -Cleanup
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# ───────────────────────────────────────────────────────────
|
||||||
|
# 2) If user only wants the site list, do that and exit
|
||||||
|
# ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
'DattoFetch' {
|
||||||
|
Write-LogHybrid "Fetching site list only…" Info DattoAuth
|
||||||
|
$sites = Get-DattoRmmSites -Password $N8nPassword
|
||||||
|
|
||||||
|
$ext = [IO.Path]::GetExtension($OutputFile).ToLower()
|
||||||
|
if ($ext -eq '.json') {
|
||||||
|
$sites | ConvertTo-Json -Depth 3 | Out-File -FilePath $OutputFile -Encoding UTF8
|
||||||
|
} else {
|
||||||
|
$sites | Export-Csv -Path $OutputFile -NoTypeInformation -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-LogHybrid "Wrote $($sites.Count) sites to $OutputFile" Success DattoAuth
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# 3) Invoke the existing Install-DattoRMM cmdlet
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
|
||||||
|
'DattoInstall' {
|
||||||
|
Write-LogHybrid "Headless DattoRMM deploy" Info DattoAuth
|
||||||
|
if ($PSCmdlet.ShouldProcess("Datto site '$SiteName'", "Headless install")) {
|
||||||
|
Install-DattoRMM `
|
||||||
|
-ApiUrl $Global:ApiUrl `
|
||||||
|
-ApiKey $Global:ApiKey `
|
||||||
|
-ApiSecretKey $Global:ApiSecretKey `
|
||||||
|
-SiteUID $SiteUID `
|
||||||
|
-SiteName $SiteName `
|
||||||
|
-PushSiteVars:$PushSiteVars `
|
||||||
|
-InstallRMM:$InstallRMM `
|
||||||
|
-SaveCopy:$SaveCopy
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
'UI' {
|
||||||
|
Write-LogHybrid "Launching UI" Info Startup
|
||||||
|
Write-Host "Starting ScriptMonkey UI on http://localhost:$Port/" -ForegroundColor Cyan
|
||||||
|
Start-Process "msedge.exe" -ArgumentList "--app=http://localhost:$Port"
|
||||||
|
Start-Server # blocks until you click Exit
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion ScriptMonkey run silently Entrypoint
|
||||||
|
|
||||||
|
Write-Host "🛠️ SAMY - Script Automation Monkey (Yeah!)" -ForegroundColor Cyan
|
||||||
|
Write-Host "ParameterSetName: $($PSCmdlet.ParameterSetName)" -ForegroundColor Yellow
|
||||||
|
|
||||||
|
#region — guarantee NuGet provider is present without prompting
|
||||||
|
|
||||||
|
# ─── Top of script ───
|
||||||
|
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
# ─── ensure TLS 1.2 + no prompts ───
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
$ConfirmPreference = 'None'
|
||||||
|
|
||||||
|
# check if NuGet exists (no output—assigned to $nuget)
|
||||||
|
$nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if (-not $nuget) {
|
||||||
|
# install it (again, assignment suppresses the table)
|
||||||
|
Install-PackageProvider `
|
||||||
|
-Name NuGet `
|
||||||
|
-MinimumVersion 2.8.5.201 `
|
||||||
|
-Force `
|
||||||
|
-Confirm:$false
|
||||||
|
|
||||||
|
|
||||||
|
# re-query just for version info
|
||||||
|
$found = Get-PackageProvider -Name NuGet -ListAvailable
|
||||||
|
Write-Host "Installed NuGet provider v$($found.Version)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "NuGet provider already present (v$($found.Version))" -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
|
||||||
|
# now import it silently
|
||||||
|
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
# ensure trust PSGallery without its own output (so you don't get “untrusted repository” prompt
|
||||||
|
$gallery = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
|
||||||
|
if ($gallery.InstallationPolicy -ne 'Trusted') {
|
||||||
|
Set-PSRepository `
|
||||||
|
-Name PSGallery `
|
||||||
|
-InstallationPolicy Trusted `
|
||||||
|
-ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
Write-Host "PSGallery marked as Trusted" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────
|
||||||
# 2) GLOBAL SETTINGS & HELPERS
|
# 2) GLOBAL SETTINGS & HELPERS
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────
|
||||||
@@ -313,131 +435,6 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ScriptMonkey run silently Entrypoint
|
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
# 3) MAIN LOGIC (Toolkit vs DattoFetch vs DattoInstall vs UI)
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
|
||||||
'Toolkit' {
|
|
||||||
Write-LogHybrid "Toolkit-only mode" Info Startup
|
|
||||||
Install-SVSMSP -InstallToolkit
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
'Cleanup' {
|
|
||||||
Write-LogHybrid "Running Toolkit cleanup mode" Info Startup
|
|
||||||
Install-SVSMSP -Cleanup
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# ───────────────────────────────────────────────────────────
|
|
||||||
# 2) If user only wants the site list, do that and exit
|
|
||||||
# ───────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
'DattoFetch' {
|
|
||||||
Write-LogHybrid "Fetching site list only…" Info DattoAuth
|
|
||||||
$sites = Get-DattoRmmSites -Password $N8nPassword
|
|
||||||
|
|
||||||
$ext = [IO.Path]::GetExtension($OutputFile).ToLower()
|
|
||||||
if ($ext -eq '.json') {
|
|
||||||
$sites | ConvertTo-Json -Depth 3 | Out-File -FilePath $OutputFile -Encoding UTF8
|
|
||||||
} else {
|
|
||||||
$sites | Export-Csv -Path $OutputFile -NoTypeInformation -Encoding UTF8
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-LogHybrid "Wrote $($sites.Count) sites to $OutputFile" Success DattoAuth
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# ────────────────────────────────────────────
|
|
||||||
# 3) Invoke the existing Install-DattoRMM cmdlet
|
|
||||||
# ────────────────────────────────────────────
|
|
||||||
|
|
||||||
'DattoInstall' {
|
|
||||||
Write-LogHybrid "Headless DattoRMM deploy" Info DattoAuth
|
|
||||||
if ($PSCmdlet.ShouldProcess("Datto site '$SiteName'", "Headless install")) {
|
|
||||||
Install-DattoRMM `
|
|
||||||
-ApiUrl $Global:ApiUrl `
|
|
||||||
-ApiKey $Global:ApiKey `
|
|
||||||
-ApiSecretKey $Global:ApiSecretKey `
|
|
||||||
-SiteUID $SiteUID `
|
|
||||||
-SiteName $SiteName `
|
|
||||||
-PushSiteVars:$PushSiteVars `
|
|
||||||
-InstallRMM:$InstallRMM `
|
|
||||||
-SaveCopy:$SaveCopy
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
'UI' {
|
|
||||||
Write-Host "Launching UI" Info Startup -ForegroundColor Cyan
|
|
||||||
Write-Host "Starting ScriptMonkey UI on http://localhost:$Port/" -ForegroundColor Cyan
|
|
||||||
Start-Process "msedge.exe" -ArgumentList "--app=http://localhost:$Port"
|
|
||||||
Start-Server # blocks until you click Exit
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion ScriptMonkey run silently Entrypoint
|
|
||||||
|
|
||||||
Write-Host "🛠️ SAMY - Script Automation Monkey (Yeah!)" -ForegroundColor Cyan
|
|
||||||
Write-Host "ParameterSetName: $($PSCmdlet.ParameterSetName)" -ForegroundColor Yellow
|
|
||||||
|
|
||||||
#region — guarantee NuGet provider is present without prompting
|
|
||||||
|
|
||||||
# ─── Top of script ───
|
|
||||||
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
# ─── ensure TLS 1.2 + no prompts ───
|
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
|
||||||
$ConfirmPreference = 'None'
|
|
||||||
|
|
||||||
# check if NuGet exists (no output—assigned to $nuget)
|
|
||||||
$nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue
|
|
||||||
|
|
||||||
if (-not $nuget) {
|
|
||||||
# install it (again, assignment suppresses the table)
|
|
||||||
Install-PackageProvider `
|
|
||||||
-Name NuGet `
|
|
||||||
-MinimumVersion 2.8.5.201 `
|
|
||||||
-Force `
|
|
||||||
-Confirm:$false
|
|
||||||
|
|
||||||
|
|
||||||
# re-query just for version info
|
|
||||||
$found = Get-PackageProvider -Name NuGet -ListAvailable
|
|
||||||
Write-Host "Installed NuGet provider v$($found.Version)" -ForegroundColor Green
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "NuGet provider already present (v$($found.Version))" -ForegroundColor DarkGray
|
|
||||||
}
|
|
||||||
|
|
||||||
# now import it silently
|
|
||||||
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
# ensure trust PSGallery without its own output (so you don't get “untrusted repository” prompt
|
|
||||||
$gallery = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
|
|
||||||
if ($gallery.InstallationPolicy -ne 'Trusted') {
|
|
||||||
Set-PSRepository `
|
|
||||||
-Name PSGallery `
|
|
||||||
-InstallationPolicy Trusted `
|
|
||||||
-ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
Write-Host "PSGallery marked as Trusted" -ForegroundColor Green
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Config & Task Definitions
|
#region Config & Task Definitions
|
||||||
|
|
||||||
# Define every task once here:
|
# Define every task once here:
|
||||||
@@ -1372,18 +1369,10 @@ $style
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="logo-container">
|
<div class="logo-container">
|
||||||
<!-- SVS Logo (left) -->
|
|
||||||
<div class="logo-left">
|
<div class="logo-left">
|
||||||
<img src="https://git.svstools.com/syelle/Logo/raw/branch/main/SVS_logo.svg" alt="SVS Logo">
|
<img src="https://git.svstools.com/syelle/Logo/raw/branch/main/SVS_logo.svg" alt="SVS Logo">
|
||||||
{{moduleVersion}}
|
{{moduleVersion}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- SAMY Logo (right) -->
|
|
||||||
<div class="logo-right" style="text-align:right;">
|
|
||||||
<img src="https://git.svstools.com/syelle/Logo/raw/branch/main/SAMY.png" alt="SAMY Logo" style="max-width:240px;">
|
|
||||||
<div id="tagline" style="font-size:1.1rem; color:var(--light-gray-color); font-weight:bold;">Script Automation Monkey (Yeah!)</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tagline"></div>
|
<div id="tagline"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user