fixed the install module

This commit is contained in:
2025-05-27 00:37:50 -04:00
parent db2dfc1eae
commit 68ed03d32e

View File

@@ -219,8 +219,49 @@ function Install-DattoRMM-Helper {
} }
#endregion #endregion
# POST /getpw → read JSON body, call helper, return JSON #region SVS Module
function Install-SVSMSP {
param (
[switch] $Cleanup,
[switch] $InstallToolkit,
[Parameter(Mandatory = $false)][array] $AllModules = @(@{ ModuleName = "SVS_Toolkit" }, @{ ModuleName = "SVSMSP" }),
[Parameter(Mandatory = $false)][array] $AllRepositories = @(@{ RepoName = "SVS_Repo" }, @{ RepoName = "SVS_Toolkit" }),
[Parameter(Mandatory = $false)][string] $NewModuleName = "SVSMSP",
[Parameter(Mandatory = $false)][string] $NewRepositoryName = "SVS_Repo",
[Parameter(Mandatory = $false)][string] $NewRepositoryURL = "http://proget.svstools.ca:8083/nuget/SVS_Repo/"
)
function Perform-Cleanup {
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
# …your old cleanup logic here…
}
function Perform-ToolkitInstallation {
Perform-Cleanup
Write-LogHybrid "Registering repo $NewRepositoryName" "Info" "SVSModule"
if (-not (Get-PSRepository -Name $NewRepositoryName -ErrorAction SilentlyContinue)) {
Register-PSRepository -Name $NewRepositoryName -SourceLocation $NewRepositoryURL -InstallationPolicy Trusted
}
Write-LogHybrid "Installing module $NewModuleName" "Info" "SVSModule"
Install-Module -Name $NewModuleName -Repository $NewRepositoryName -Scope AllUsers -Force
Write-LogHybrid "Toolkit installation complete." "Success" "SVSModule"
}
Write-LogHybrid "Install-SVSMSP called" "Info" "SVSModule"
if ($Cleanup) {
Perform-Cleanup; return
}
if ($InstallToolkit) {
Perform-ToolkitInstallation; return
}
# default if no switch passed:
Perform-ToolkitInstallation
}
#endregion
# POST /getpw → read JSON body, call helper, return JSON
function Handle-FetchSites { function Handle-FetchSites {
param($Context) param($Context)
@@ -302,10 +343,6 @@ function returnRespondEmpty {
} }
# On-boarding handlers # On-boarding handlers
function Set-SVSPowerPlan { function Set-SVSPowerPlan {
param($Context) param($Context)
@@ -314,9 +351,16 @@ function Set-SVSPowerPlan {
} }
function Install-SVSMSPModule { function Install-SVSMSPModule {
param($Context) param($Context)
Write-LogHybrid "SVSMSP Module installed" "Success" "OnBoard" Write-LogHybrid "HTTP trigger: Install-SVSMSPModule" "Info" "OnBoard"
Respond-Text $Context "SVSMSP Module installed" try {
Install-SVSMSP -InstallToolkit
Respond-Text $Context "SVSMSP Module installed/updated."
} catch {
Write-LogHybrid "Error in Install-SVSMSP: $_" "Error" "OnBoard"
Respond-Text $Context "ERROR: $_"
}
} }
function Install-CyberQP { function Install-CyberQP {
param($Context) param($Context)
Write-LogHybrid "CyberQP installed" "Success" "OnBoard" Write-LogHybrid "CyberQP installed" "Success" "OnBoard"