diff --git a/pilot_install.ps1 b/pilot_install.ps1 index c271701..b8f5fe5 100644 --- a/pilot_install.ps1 +++ b/pilot_install.ps1 @@ -1,3 +1,32 @@ + +function Initialize-SystemConfiguration { + Write-Log "`nSetting High Performance power plan..." + Set-HighPerformancePowerPlan + + Write-Log "`nRenaming computer..." + Rename-PCToMac + + Write-Log "`nDisabling UAC and notifications..." + Disable-UACAndNotifications + + Write-Log "`nSetting main connection as PRIVATE..." + Get-NetConnectionProfile | + Where-Object { $_.InterfaceAlias -like "*Ethernet*" } | + Set-NetConnectionProfile -NetworkCategory Private + + 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: $_" + } +} + + Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() @@ -300,11 +329,10 @@ $buttonsPanel.Margin = New-Object System.Windows.Forms.Padding(0) $form.Controls.Add($buttonsPanel) $buttons = @( - @{ Text = "Install Portrait CabTab"; Action = { Install-Pilot -Mode "Portrait" } }, - @{ Text = "Install Portrait CabTab"; Action = { Install-Pilot -Mode "PortraitR" } }, - @{ Text = "Install Dual Lojas"; Action = { Install-Pilot -Mode "Dual" } }, - @{ Text = "Install Dual Rua"; Action = { Install-Pilot -Mode "DualR" } }, - @{ Text = "Install Botoneira"; Action = { Install-Pilot -Mode "Botoneira" } }, + @{ Text = "Install Portrait CabTab"; Action = { Initialize-SystemConfiguration; Upgrade-PortraitCabTab } }, + @{ Text = "Install Dual"; Action = { Initialize-SystemConfiguration; Install-Pilot -Mode "Dual" } }, + @{ Text = "Install Dual Rua"; Action = { Initialize-SystemConfiguration; Install-Pilot -Mode "DualR" } }, + @{ Text = "Install Botoneira"; Action = { Initialize-SystemConfiguration; Install-Pilot -Mode "Botoneira" } }, @{ Text = "Exit"; Action = { $form.Close() } } ) @@ -332,10 +360,9 @@ $form.ShowDialog() function Upgrade-PortraitCabTab { + Initialize-SystemConfiguration - Set-HighPerformancePowerPlan - Rename-PCToMac - Disable-UACAndNotifications + Initialize-SystemConfiguration Write-Log "`nSetting main connection as PRIVATE..." Get-NetConnectionProfile |