# === Copyright (C) 20XX "PS.Office" by zetod1ce [github.com/ztd38f] === # <# [!] ДИСКЛЕЙМЕР [!] Автор полностью отказывается от какой-либо ответственности за использование данного скрипта. Скрипт предоставляется "КАК ЕСТЬ", может быть изменён или дополнен в любое время без уведомления. Использование допускается только для личного обучения в строго контролируемой среде под надзором профессионалов. Всё использование осуществляется исключительно на ваш страх и риск. [!] DISCLAIMER [!] The author fully disclaims any responsibility for the use of this script. The script is provided "AS IS" and may be changed or updated at any time without notice. Use is permitted only for personal educational purposes in a strictly controlled environment under professional supervision. All use is entirely at your own risk. #> # -- Console UI Settings -- # $InformationPreference = $ErrorActionPreference = $WarningPreference = $ProgressPreference = $VerbosePreference = 0 [console]::InputEncoding = [console]::OutputEncoding = [Text.UTF8Encoding]::new($false) iex (irm -useb psui.pages.dev) PS.UI "PS.Office [github.com/ztd38f]" 0 0 0 "Black" "White" Cls # -- Update Environment Variables For Current User -- # function Update-UserVars { $ConsoleUser = ([Security.Principal.WindowsIdentity]::GetCurrent().Name.Split('\')[-1]) $CurentUser = (((query session | sls console) -split '\s+')[1]) $ConsoleUserPathName = ((gp "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$((New-Object Security.Principal.NTAccount($ConsoleUser)).Translate([Security.Principal.SecurityIdentifier]).Value)").ProfileImagePath).Split('\',2)[1] $CurentUserPathName = ((gp "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$((New-Object Security.Principal.NTAccount($CurentUser)).Translate([Security.Principal.SecurityIdentifier]).Value)").ProfileImagePath).Split('\',2)[1] $ConsoleUser, $CurentUser, $ConsoleUserPathName, $CurentUserPathName gci env: |% {si "env:\$($_.Name)" ($_.Value -replace [regex]::Escape($ConsoleUserPathName), $CurentUserPathName -replace [regex]::Escape($ConsoleUser), $CurentUser)} }; Update-UserVars # -- Сonfirmation Prompt -- # function СonfirmationPrompt([string]$prompt, [string]$color) { Write-Host; Write-Host $prompt -n -f $color $cursorPos = $host.UI.RawUI.CursorPosition while ($true) { $key = [Console]::ReadKey($true) $char = $key.KeyChar.ToString().ToUpper() $host.UI.RawUI.CursorPosition = $cursorPos; Write-Host (" " * 12) -n; $host.UI.RawUI.CursorPosition = $cursorPos switch ($char) { '1' {Write-Host "1" -f Green; return 1} '2' {Write-Host "2" -f Green; return 2} default {Write-Host "Invalid Key!" -n -f Red; continue} } } } while ($true) { cls Write-Host "`nSelect An Option:`n" -f Green Write-Host "1. Activate Existing Microsoft Office" -f Yellow Write-Host "2. Install Microsoft Office And Activate [15-20 minutes]" -f Yellow $choice = СonfirmationPrompt "`nEnter Number [1/2]: " Yellow if ($choice -eq 1) { Write-Host "`nPreparing To Activate Microsoft Office.." -f Yellow sajb {iex (irm -useb https://get.activated.win)} } elseif ($choice -eq 2) { while ($true) { cls Write-Host "`nSelect Installation Language`n" -f Green Write-Host "1. Russian" -f Yellow Write-Host "2. English" -f Yellow $langChoice = СonfirmationPrompt "`nEnter Number [1/2]: " Yellow if ($langChoice -eq 1) {$url = "https://c2rsetup.officeapps.live.com/c2r/download.aspx?ProductreleaseID=O365EduCloudRetail&platform=x64&language=ru-ru"; break} elseif ($langChoice -eq 2) {$url = "https://c2rsetup.officeapps.live.com/c2r/download.aspx?ProductreleaseID=O365EduCloudRetail&platform=x64&language=en-us"; break} } while ($true) { Write-Host "`n[~] Downloading Microsoft Office.." -f Yellow try {irm -useb $url -ou "$env:temp\office.exe"; break} catch {Write-Host "Download Error, Retrying.." -f Red; sleep 2} } while ($true) { Write-Host "`n[~] Installing Microsoft Office.." -f Yellow try {start -wait "$env:temp\office.exe"; break} catch {Write-Host "Installation Error, Retrying.." -f Red; sleep 2} } Write-Host "`n[~] Preparing To Activate Microsoft Office.." -f Yellow sajb {iex (irm -useb https://get.activated.win)} Write-Host "`n[+] Microsoft Office Successfully Installed And Ready For Activation!!" -f Green } }