Atualizacao Pilot_Installer_Utilities
This commit is contained in:
@@ -312,61 +312,200 @@ function Disable-UACAndNotifications {
|
||||
}
|
||||
|
||||
function Upgrade-PortraitCabTab {
|
||||
Initialize-SystemConfiguration
|
||||
|
||||
Initialize-SystemConfiguration
|
||||
$OriginalLocation = Get-Location
|
||||
|
||||
Write-Log "`nSetting main connection as PRIVATE..."
|
||||
Get-NetConnectionProfile |
|
||||
Where-Object { $_.InterfaceAlias -like "*Ethernet*" } |
|
||||
Set-NetConnectionProfile -NetworkCategory Private
|
||||
$CabTabPath = "C:\PilotDownloads\CabTabInstall"
|
||||
$PilotPath = "C:\pilotgames"
|
||||
$DownloadsPath = Join-Path $PilotPath "downloads"
|
||||
|
||||
function Invoke-Step {
|
||||
|
||||
param(
|
||||
[string]$Description,
|
||||
[scriptblock]$Command
|
||||
)
|
||||
|
||||
Write-Log ""
|
||||
Write-Log "========================================"
|
||||
Write-Log $Description
|
||||
|
||||
try {
|
||||
|
||||
& $Command
|
||||
|
||||
Write-Log "[ OK ] $Description"
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
Write-Log "[ERRO] $Description"
|
||||
Write-Log $_
|
||||
|
||||
throw
|
||||
|
||||
}
|
||||
|
||||
Write-Log "`nAdjusting System Time..."
|
||||
try {
|
||||
Set-Service w32time -StartupType Automatic -ErrorAction SilentlyContinue
|
||||
Start-Service w32time -ErrorAction SilentlyContinue
|
||||
w32tm /resync /force | Out-Null
|
||||
Write-Log "System time synchronized."
|
||||
} catch {
|
||||
Write-Log "Could not synchronize system time: $_"
|
||||
}
|
||||
|
||||
Set-Location C:\PilotDownloads\CabTabInstall
|
||||
Copy-Item credentials.dat C:\pilotgames\ -Force
|
||||
Copy-Item deployAgent.bat C:\pilotgames\ -Force
|
||||
Copy-Item deployCabinet.bat C:\pilotgames\ -Force
|
||||
Copy-Item site_director.cfg C:\pilotgames\ -Force
|
||||
Copy-Item start.bat C:\pilotgames\ -Force
|
||||
Copy-Item OHGDRelease-2026.05.07.1.zip C:\pilotgames\downloads\ -Force
|
||||
Copy-Item PilotGameAgentRelease-2026.6.2.1.zip C:\pilotgames\downloads\ -Force
|
||||
reg import "PG Settings.reg"
|
||||
Start-Process windowsdesktop-runtime-8.0.15-win-x64.exe -ArgumentList "/quiet /norestart" -Wait
|
||||
try {
|
||||
|
||||
Remove-Item C:\pilot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Initialize-SystemConfiguration
|
||||
|
||||
Set-Location C:\pilotgames
|
||||
net stop PilotGameAgent
|
||||
sc.exe delete PilotGameAgent
|
||||
foreach ($Path in @($CabTabPath,$PilotPath,$DownloadsPath)) {
|
||||
|
||||
Rename-Item game_agent game_agent.ND -ErrorAction SilentlyContinue
|
||||
New-Item game_agent -ItemType Directory -Force|Out-Null
|
||||
if (!(Test-Path $Path)) {
|
||||
throw "Pasta não encontrada: $Path"
|
||||
}
|
||||
|
||||
.\deployAgent.bat 2026.6.2.1
|
||||
.\InstallGameAgentService.bat
|
||||
}
|
||||
|
||||
Set-Service -Name PilotGameAgent -StartupType Automatic
|
||||
Set-Location $CabTabPath
|
||||
Write-Log "Diretório atual: $(Get-Location)"
|
||||
|
||||
Remove-Item NDGDRelease*.zip -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item NDGDRelease.bak -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item BRGDRelease.bak -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Invoke-Step "Copiando credentials.dat" {
|
||||
Copy-Item ".\credentials.dat" $PilotPath -Force
|
||||
}
|
||||
|
||||
if(Test-Path NDGDRelease){Move-Item NDGDRelease NDGDRelease.bak}
|
||||
if(Test-Path BRGDRelease){Move-Item BRGDRelease BRGDRelease.bak}
|
||||
Invoke-Step "Copiando deployAgent.bat" {
|
||||
Copy-Item ".\deployAgent.bat" $PilotPath -Force
|
||||
}
|
||||
|
||||
.\deployCabinet.bat 2026.05.07.1
|
||||
Invoke-Step "Copiando deployCabinet.bat" {
|
||||
Copy-Item ".\deployCabinet.bat" $PilotPath -Force
|
||||
}
|
||||
|
||||
Invoke-Step "Copiando site_director.cfg" {
|
||||
Copy-Item ".\site_director.cfg" $PilotPath -Force
|
||||
}
|
||||
|
||||
Invoke-Step "Copiando start.bat" {
|
||||
Copy-Item ".\start.bat" $PilotPath -Force
|
||||
}
|
||||
|
||||
Invoke-Step "Copiando OHGDRelease" {
|
||||
Copy-Item ".\OHGDRelease-2026.05.07.1.zip" $DownloadsPath -Force
|
||||
}
|
||||
|
||||
Invoke-Step "Copiando PilotGameAgentRelease" {
|
||||
Copy-Item ".\PilotGameAgentRelease-2026.6.2.1.zip" $DownloadsPath -Force
|
||||
}
|
||||
|
||||
Invoke-Step "Importando configurações do registro" {
|
||||
reg import "PG Settings.reg"
|
||||
}
|
||||
|
||||
Invoke-Step "Instalando .NET Desktop Runtime" {
|
||||
|
||||
$proc = Start-Process `
|
||||
".\windowsdesktop-runtime-8.0.15-win-x64.exe" `
|
||||
-ArgumentList "/quiet /norestart" `
|
||||
-Wait `
|
||||
-PassThru
|
||||
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
throw "Instalação do Runtime retornou ExitCode $($proc.ExitCode)"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Set-Location $PilotPath
|
||||
|
||||
Invoke-Step "Removendo C:\pilot" {
|
||||
Remove-Item "C:\pilot" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Invoke-Step "Parando serviço PilotGameAgent" {
|
||||
Stop-Service PilotGameAgent -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Invoke-Step "Removendo serviço PilotGameAgent" {
|
||||
sc.exe delete PilotGameAgent | Out-Null
|
||||
}
|
||||
|
||||
Invoke-Step "Renomeando game_agent" {
|
||||
|
||||
if (Test-Path ".\game_agent.ND") {
|
||||
Remove-Item ".\game_agent.ND" -Recurse -Force
|
||||
}
|
||||
|
||||
if (Test-Path ".\game_agent") {
|
||||
Rename-Item ".\game_agent" "game_agent.ND"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Invoke-Step "Criando novo diretório game_agent" {
|
||||
New-Item ".\game_agent" -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
|
||||
Invoke-Step "Executando deployAgent" {
|
||||
& ".\deployAgent.bat" "2026.6.2.1"
|
||||
}
|
||||
|
||||
Invoke-Step "Instalando serviço PilotGameAgent" {
|
||||
& ".\InstallGameAgentService.bat"
|
||||
}
|
||||
|
||||
Invoke-Step "Configurando serviço para Automático" {
|
||||
Set-Service PilotGameAgent -StartupType Automatic
|
||||
}
|
||||
|
||||
Invoke-Step "Limpando arquivos antigos" {
|
||||
|
||||
Remove-Item ".\NDGDRelease*.zip" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item ".\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item ".\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
}
|
||||
|
||||
Invoke-Step "Criando backup das releases" {
|
||||
|
||||
if (Test-Path ".\NDGDRelease") {
|
||||
Move-Item ".\NDGDRelease" ".\NDGDRelease.bak"
|
||||
}
|
||||
|
||||
if (Test-Path ".\BRGDRelease") {
|
||||
Move-Item ".\BRGDRelease" ".\BRGDRelease.bak"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Invoke-Step "Executando deployCabinet" {
|
||||
& ".\deployCabinet.bat" "2026.05.07.1"
|
||||
}
|
||||
|
||||
Invoke-Step "Reiniciando Explorer" {
|
||||
taskkill /IM explorer.exe /F | Out-Null
|
||||
}
|
||||
|
||||
Invoke-Step "Iniciando serviço PilotGameAgent" {
|
||||
Start-Service PilotGameAgent
|
||||
}
|
||||
|
||||
Write-Log ""
|
||||
Write-Log "========================================"
|
||||
Write-Log "Upgrade Portrait CabTab concluído com sucesso."
|
||||
Write-Log "========================================"
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
Write-Log ""
|
||||
Write-Log "========================================"
|
||||
Write-Log "FALHA DURANTE O UPGRADE"
|
||||
Write-Log $_
|
||||
Write-Log "========================================"
|
||||
|
||||
throw
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
Set-Location $OriginalLocation
|
||||
|
||||
}
|
||||
|
||||
taskkill /IM explorer.exe /F
|
||||
net start PilotGameAgent
|
||||
}
|
||||
|
||||
# GUI
|
||||
|
||||
Reference in New Issue
Block a user