if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -Command `"iex (irm https://scripts.infotrust.cloud/installmesh.ps1)`"" -Verb RunAs exit } $downloadUrl = "https://itc.wiki/meshagent64-unsorted.exe" $tempPath = [System.IO.Path]::GetTempPath() $exePath = Join-Path -Path $tempPath -ChildPath "meshagent64-unsorted.exe" try { Write-Host "Downloading Mesh Agent..." Invoke-WebRequest -Uri $downloadUrl -OutFile $exePath -UseBasicParsing Write-Host "Installing Mesh Agent..." $installProcess = Start-Process -FilePath $exePath -ArgumentList "-fullinstall" -Wait -NoNewWindow -PassThru if ($installProcess.ExitCode -ne 0) { throw "Installation failed with exit code $($installProcess.ExitCode)" } Write-Host "Installation completed successfully" } catch { Write-Error "Error occurred: $_" } finally { if (Test-Path $exePath) { Remove-Item -Path $exePath -Force Write-Host "Cleanup completed" } }