$goreloProcesses = @("Gorelo.Rmm.Installer", "Gorelo.RemoteManagement.Shell", "Gorelo.RemoteManagement.Agent"); $processList = (Get-Process).ProcessName; if ((($goreloProcesses | Where-Object { $_ -notin $processList }) | Measure-Object).Count -eq 0) { $Host.UI.WriteWarningLine('Gorelo is already installed on this device'); return; } $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()); if($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { if (-not $Env:ProgramW6432) { $Host.UI.WriteErrorLine('Failed to run script. Error: 64-bit Program Files folder not found.'); return; } $headers = @{ "Content-Type" = "application/json" }; $body = @{ LicenseKey = "GSTqMM0fYknfUR5lWKL5tF06B6qxcYXCWyNvQknQ3m11empiA+Kqkg=="; Hostname = hostname; Os = "windows"; } | ConvertTo-Json; $response = Invoke-RestMethod 'https://gw.usw.gorelo.tech/rmm-login/api/login/rmm/device/registration/limit' -Method 'POST' -Body $body -Headers $headers; if($response.isSuccess -eq $true) { $goreloDir = "$Env:ProgramW6432\Gorelo"; $setupDir = "$goreloDir\Setup"; $downloadsDirectory = "$goreloDir\Installer\Downloads"; $downloadPath = "$downloadsDirectory\Gorelo.Rmm.Setup.zip"; Remove-Item -path $goreloDir -recurse -ErrorAction SilentlyContinue; New-Item -Path $downloadsDirectory -ItemType Directory > $null -ErrorAction SilentlyContinue; Invoke-WebRequest -Uri $response.setupDownloadUrl -OutFile $downloadPath; Expand-Archive -Path $downloadPath -DestinationPath $setupDir -Force; Start-Process -FilePath "$setupDir\Gorelo.Rmm.Setup\Gorelo.Rmm.Setup.exe" -ArgumentList "--i --l GSTqMM0fYknfUR5lWKL5tF06B6qxcYXCWyNvQknQ3m11empiA+Kqkg==" -WindowStyle Hidden; } else { $Host.UI.WriteErrorLine('Failed to install. Error: ' + $response.errorMessage); } } else { $Host.UI.WriteErrorLine('Failed to run script. Error: Administrator Privileges Required'); }