This commit is contained in:
2023-12-07 12:06:28 -05:00
parent c94b375aec
commit 1f69a746c9
+3 -7
View File
@@ -569,19 +569,15 @@ Function Disable-Log {
}
# Function to install the MSP360 Powershell module
Function Install-MSP360Module {
Function Import-MSP360Module {
Try {
$module = Get-Module -ListAvailable -Name MSP360
If ( (-not $module) -and (IsAdmin) ) {
If ( -not (IsAdmin) ) { Write-Output "The MSP360 Powershell module needs to be installed, but the current account is not an administrative user" ; Return }
Write-Output "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)) ) {
Write-Output "The MSP360 Powershell module needs to be installed, but the current security context is not sufficient to install it"
}
Import-Module -Name MSP360
}
Catch { Write-Error $_.Exception.Message }
}