first commit
This commit is contained in:
108
habilita-vlt-pilot.ps1
Normal file
108
habilita-vlt-pilot.ps1
Normal file
@@ -0,0 +1,108 @@
|
||||
# Elevate privileges if needed
|
||||
if (-not ([Security.Principal.WindowsPrincipal]::new([Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
|
||||
[Security.Principal.WindowsBuiltInRole]::Administrator))) {
|
||||
Start-Process powershell -Verb runAs -ArgumentList $MyInvocation.MyCommand.Definition
|
||||
exit
|
||||
}
|
||||
|
||||
function Show-Banner {
|
||||
Clear-Host
|
||||
Write-Host @"
|
||||
PILOT - VLT
|
||||
"@ -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
function Show-Menu {
|
||||
Show-Banner
|
||||
Write-Host "========== CONFIGURATION MENU ==========" -ForegroundColor Cyan
|
||||
Write-Host "1. Enable High Performance Power Plan"
|
||||
Write-Host "2. Rename PC using MAC Address"
|
||||
Write-Host "3. Run both (1 and 2)"
|
||||
Write-Host "4. Install Notepad++, .NET 8, VC++"
|
||||
Write-Host "5. Disable UAC and Notifications"
|
||||
Write-Host "6. Exit"
|
||||
Write-Host "========================================`n"
|
||||
}
|
||||
|
||||
function Set-HighPerformancePowerPlan() {
|
||||
Write-Output "`nActivating High Performance power plan..."
|
||||
$highPerf = powercfg -l | Where-Object { $_ -match "High performance" -or $_ -match "Alto desempenho" }
|
||||
if ($highPerf) {
|
||||
$guid = ($highPerf -split '\s+')[3]
|
||||
powercfg -setactive $guid
|
||||
|
||||
powercfg -change -monitor-timeout-ac 0
|
||||
powercfg -change -monitor-timeout-dc 0
|
||||
powercfg -change -standby-timeout-ac 0
|
||||
powercfg -change -standby-timeout-dc 0
|
||||
powercfg -change -disk-timeout-ac 0
|
||||
powercfg -change -disk-timeout-dc 0
|
||||
|
||||
Write-Output "Power settings applied successfully.`n"
|
||||
} else {
|
||||
Write-Output "High Performance power plan not found.`n"
|
||||
}
|
||||
}
|
||||
|
||||
function Rename-PCToMac() {
|
||||
Write-Output "`nRenaming PC using MAC address..."
|
||||
$mac = (Get-NetAdapter -InterfaceAlias "*Ethernet*" | Select-Object -First 1 -ExpandProperty MacAddress) -replace '-', ''
|
||||
if ($mac) {
|
||||
Rename-Computer -NewName "$mac" -Force
|
||||
Write-Output "Computer renamed to: $mac"
|
||||
Write-Output "Please restart the computer to apply the change.`n"
|
||||
} else {
|
||||
Write-Output "Could not retrieve MAC address.`n"
|
||||
}
|
||||
}
|
||||
|
||||
function Install-CommonTools() {
|
||||
Write-Output "`nInstalling tools and dependencies via winget..."
|
||||
try {
|
||||
winget install -e --id Notepad++.Notepad++ --accept-source-agreements --accept-package-agreements
|
||||
winget install -e --id Microsoft.DotNet.DesktopRuntime.8 --accept-source-agreements --accept-package-agreements
|
||||
winget install -e --id Microsoft.VCRedist.2015+.x64 --accept-source-agreements --accept-package-agreements
|
||||
Write-Output "Installation completed.`n"
|
||||
} catch {
|
||||
Write-Output "Installation error: $_"
|
||||
}
|
||||
}
|
||||
|
||||
function Disable-UACAndNotifications() {
|
||||
Write-Output "`nDisabling UAC and notifications..."
|
||||
try {
|
||||
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 0
|
||||
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications" -Force | Out-Null
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications" -Name "DisableEnhancedNotifications" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name SearchBoxTaskbarMode -Value 0 -Type DWord -Force
|
||||
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
|
||||
Write-Output "UAC and notifications disabled.`n"
|
||||
} catch {
|
||||
Write-Output "Error while configuring system: $_"
|
||||
}
|
||||
}
|
||||
|
||||
# Main loop
|
||||
do {
|
||||
Show-Menu
|
||||
$choice = Read-Host "Select an option (1-6)"
|
||||
|
||||
switch ($choice) {
|
||||
"1" { Set-HighPerformancePowerPlan }
|
||||
"2" { Rename-PCToMac }
|
||||
"3" {
|
||||
Set-HighPerformancePowerPlan
|
||||
Rename-PCToMac
|
||||
}
|
||||
"4" { Install-CommonTools }
|
||||
"5" { Disable-UACAndNotifications }
|
||||
"6" { Write-Host "`nExiting..." -ForegroundColor Yellow }
|
||||
default { Write-Host "`nInvalid option. Please try again." -ForegroundColor Red }
|
||||
}
|
||||
|
||||
if ($choice -ne "6") {
|
||||
Pause
|
||||
}
|
||||
|
||||
} while ($choice -ne "6")
|
||||
Reference in New Issue
Block a user