move powershell module installs to Tools.ps1

update Install-EmberkomCloudBackup.ps1
This commit is contained in:
2021-09-23 13:14:16 -04:00
parent 2b8d833100
commit ce5f25e01f
4 changed files with 40 additions and 58 deletions
+35
View File
@@ -481,5 +481,40 @@ function Toggle-Log {
Catch { LogMsg $_.Exception.Message }
}
# Function to install the PSAtera Powershell module
function Install-PSAteraModule {
Try {
$module = Get-Module -ListAvailable -Name PSAtera
If ( (-not $module) -and (IsAdmin) ) {
LogMsg "Installing PSAtera Powershell module"
Install-Module -Name PSAtera -MinimumVersion 2.8.5.201
}
ElseIf ( (-not $module) -and (-not (IsAdmin)) ) {
LogMsg "The PSAtera module needs to be installed, but the current security context is not sufficient to install it"
}
ElseIf ( ($module) -and (IsAdmin) ) {
LogMsg "Updating PSAtera Powershell module"
Update-Module -Name PSAtera -Force
}
}
Catch { LogErr $_.Exception.Message }
}
# Function to install the MSP360 Powershell module
function Install-MSP360Module {
Try {
$module = Get-Module -ListAvailable -Name MSP360
If ( (-not $module) -and (IsAdmin) ) {
LogMsg "Installing MSP360 Powershell module"
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA'); Install-MSP360Module
}
ElseIf ( (-not $module) -and (-not (IsAdmin)) ) {
LogMsg "The MSP360 Powershell module needs to be installed, but the current security context is not sufficient to install it"
}
}
Catch { LogErr $_.Exception.Message }
}
Setup-MSPDirectories
Setup-LogFile