fixed the install module
This commit is contained in:
@@ -219,8 +219,49 @@ function Install-DattoRMM-Helper {
|
||||
}
|
||||
#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 {
|
||||
param($Context)
|
||||
@@ -302,10 +343,6 @@ function returnRespondEmpty {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# On-boarding handlers
|
||||
function Set-SVSPowerPlan {
|
||||
param($Context)
|
||||
@@ -314,9 +351,16 @@ function Set-SVSPowerPlan {
|
||||
}
|
||||
function Install-SVSMSPModule {
|
||||
param($Context)
|
||||
Write-LogHybrid "SVSMSP Module installed" "Success" "OnBoard"
|
||||
Respond-Text $Context "SVSMSP Module installed"
|
||||
Write-LogHybrid "HTTP trigger: Install-SVSMSPModule" "Info" "OnBoard"
|
||||
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 {
|
||||
param($Context)
|
||||
Write-LogHybrid "CyberQP installed" "Success" "OnBoard"
|
||||
|
||||
Reference in New Issue
Block a user