This commit is contained in:
2023-12-07 12:06:28 -05:00
parent c94b375aec
commit 1f69a746c9
+8 -12
View File
@@ -569,19 +569,15 @@ Function Disable-Log {
} }
# Function to install the MSP360 Powershell module # Function to install the MSP360 Powershell module
Function Install-MSP360Module { Function Import-MSP360Module {
Try { Try {
$module = Get-Module -ListAvailable -Name MSP360 If ( -not (IsAdmin) ) { Write-Output "The MSP360 Powershell module needs to be installed, but the current account is not an administrative user" ; Return }
If ( (-not $module) -and (IsAdmin) ) { Write-Output "Installing MSP360 Powershell module"
Write-Output "Installing MSP360 Powershell module" Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA')
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA') Install-MSP360Module
Install-MSP360Module Import-Module -Name MSP360
}
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"
}
} }
Catch { Write-Error $_.Exception.Message } Catch { Write-Error $_.Exception.Message }
} }