if (-not $args) { Write-Host 'Activation helper, will force an admin window to open and download some scripts' -ForegroundColor Green Write-Host '' } & { $psv = (Get-Host).Version.Major $troubleshoot = 'fix: call simon to fix this' if ($ExecutionContext.SessionState.LanguageMode.value__ -ne 0) { $ExecutionContext.SessionState.LanguageMode Write-Host "PowerShell is not running in Full Language Mode." Write-Host "fix:reg delete \"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\" /v \"__PSLockdownPolicy\" /f" -ForegroundColor White -BackgroundColor Blue return } try { [void][System.AppDomain]::CurrentDomain.GetAssemblies(); [void][System.Math]::Sqrt(144) } catch { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red Write-Host "Powershell failed to load .NET command." Write-Host "$troubleshoot" -ForegroundColor White -BackgroundColor Blue return } function Check3rdAV { $cmd = if ($psv -ge 3) { 'Get-CimInstance' } else { 'Get-WmiObject' } $avList = & $cmd -Namespace root\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName if ($avList) { Write-Host '3rd party Antivirus might be blocking the script - ' -ForegroundColor White -BackgroundColor Blue -NoNewline Write-Host " $($avList -join ', ')" -ForegroundColor DarkRed -BackgroundColor White } } function CheckFile { param ([string]$FilePath) if (-not (Test-Path $FilePath)) { Check3rdAV Write-Host "Failed to create MAS file in temp folder, aborting!" Write-Host "$troubleshoot" -ForegroundColor White -BackgroundColor Blue throw } } try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {} Write-Progress -Activity "Downloading..." -Status "Please wait" $errors = @() try { if ($psv -ge 3) { $response = Invoke-RestMethod 'https://get.activated.win' | iex } else { Write-Host "$troubleshoot" -ForegroundColor White -BackgroundColor Blue } break } catch { $errors += $_ } } @args