├── README.md └── Tweak.ps1 /README.md: -------------------------------------------------------------------------------- 1 | # Otimização do Windows com PowerShell 2 | 3 | Transforme seu Windows em uma máquina leve e eficiente! Este script automatiza ajustes de desempenho, desativa serviços desnecessários e limpa o sistema em poucos passos. 4 | 5 | > **Nota**: O Windows Defender pode sinalizar o script como suspeito devido a alterações no Registro, elevação de privilégios ou falta de assinatura digital. Isso é comum em scripts de otimização – veja detalhes abaixo. 6 | 7 | --- 8 | 9 | ## Por que usar? 10 | - **Velocidade**: Menos processos, inicialização mais rápida. 11 | - **Estabilidade**: Reduz travamentos e uso de recursos. 12 | - **Eficiência**: Sistema otimizado para qualquer tarefa. 13 | - **Controle**: Personalize configurações essenciais. 14 | - **Escalabilidade**: Ideal para hardware moderno. 15 | 16 | --- 17 | 18 | ## Funcionalidades 19 | - **Desativação de Serviços**: Telemetria, Xbox, Windows Update (opcional). 20 | - **Limpeza Automática**: Arquivos temporários, caches, prefetch. 21 | - **Ajuste de Energia**: Ativa modo de alto desempenho. 22 | - **Reparo do Sistema**: Executa `sfc` e `DISM`. 23 | - **Boot Rápido**: Desativa hibernação e tarefas agendadas. 24 | 25 | --- 26 | 27 | ## Por que o Defender pode sinalizar? 28 | - Alterações no Registro (`HKLM`, `HKCU`) e serviços (`wuauserv`, `SysMain`). 29 | - Execução como administrador e comandos sensíveis (`powercfg`, `Remove-Item`). 30 | - Heurística comportamental detecta padrões "suspeitos". 31 | - **Solução**: Adicione o script como exceção no Defender ou assine digitalmente. 32 | 33 | --- 34 | 35 | ## Como Usar 36 | 37 | ### Pré-requisitos 38 | - PowerShell 5.1+ (nativo no Windows). 39 | - Executar como administrador. 40 | 41 | ### Instalação 42 | 1. Clone o repositório: 43 | ```bash 44 | git clone https://github.com/danielfrade/windows 45 | ``` 46 | 2. Execute o script: 47 | ```powershell 48 | .\Tweak.ps1 49 | ``` 50 | 3. Reinicie após a execução. 51 | 52 | --- 53 | 54 | ## Estrutura 55 | - `Tweak.ps1`: Script principal. 56 | - `README.md`: Documentação. 57 | 58 | --- 59 | 60 | ## Exemplos 61 | - **Otimização Total**: Execute e veja o Windows voar! 62 | - **Ajuste Personalizado**: Edite o script para preservar serviços específicos. 63 | 64 | --- 65 | 66 | ## Contribuições 67 | Quer colaborar? Faça um fork, crie uma branch (`git checkout -b feature/nova-ideia`), commit suas mudanças e envie um Pull Request! 68 | -------------------------------------------------------------------------------- /Tweak.ps1: -------------------------------------------------------------------------------- 1 | # Script de Gestão de Ativos de Equipamentos no Domínio 2 | # Autor: Daniel Vocurca Frade 3 | # Versão: 2.0 4 | # Data: 19/03/2025 5 | 6 | # Função para verificar privilégios de administrador 7 | function Test-Admin { 8 | $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() 9 | $principal = New-Object Security.Principal.WindowsPrincipal($currentUser) 10 | if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { 11 | Write-Host "Este script requer privilégios de administrador. Solicitando elevação..." -ForegroundColor Yellow 12 | try { 13 | Start-Process powershell.exe -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" 14 | Exit 15 | } catch { 16 | Write-Host "Erro ao tentar elevar privilégios: $_" -ForegroundColor Red 17 | Exit 1 18 | } 19 | } 20 | } 21 | 22 | # Função para processar serviços 23 | function Disable-Services { 24 | param ([string[]]$ServiceList) 25 | foreach ($service in $ServiceList) { 26 | try { 27 | $svc = Get-Service -Name $service -ErrorAction SilentlyContinue 28 | if ($svc) { 29 | Stop-Service -Name $service -Force -ErrorAction Stop 30 | Set-Service -Name $service -StartupType Disabled -ErrorAction Stop 31 | Write-Host "Serviço $service desativado com sucesso." -ForegroundColor Cyan 32 | } 33 | } catch { 34 | Write-Host "Erro ao desativar serviço $service : $_" -ForegroundColor Yellow 35 | } 36 | } 37 | } 38 | 39 | # Função para processar features do Windows 40 | function Disable-Features { 41 | param ([string[]]$FeatureList) 42 | foreach ($feature in $FeatureList) { 43 | try { 44 | Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart -ErrorAction Stop 45 | Write-Host "Recurso $feature desativado com sucesso." -ForegroundColor Cyan 46 | } catch { 47 | Write-Host "Erro ao desativar recurso $feature : $_" -ForegroundColor Yellow 48 | } 49 | } 50 | } 51 | 52 | # Início do script 53 | Clear-Host 54 | Test-Admin 55 | Write-Host "Iniciando otimizações avançadas extremas para seu Windows (com Wi-Fi e Spooler preservados)..." -ForegroundColor Green 56 | Start-Sleep -Seconds 2 57 | 58 | # 1. Otimizações visuais 59 | Write-Host "`n[1/10] Otimizando interface visual..." -ForegroundColor Magenta 60 | try { 61 | $visualSettings = @{ 62 | "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" = @{ "VisualFXSetting" = 2 } 63 | "HKCU:\Control Panel\Desktop" = @{ 64 | "UserPreferencesMask" = [byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00) 65 | "FontSmoothing" = 0 66 | "DragFullWindows" = 0 67 | } 68 | "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{ 69 | "TaskbarAnimations" = 0 70 | "ListviewShadow" = 0 71 | "IconsOnly" = 1 72 | "ListviewAlphaSelect" = 0 73 | } 74 | "HKCU:\Control Panel\Desktop\WindowMetrics" = @{ 75 | "MinAnimate" = 0 76 | "BorderWidth" = 0 77 | } 78 | "HKCU:\Software\Microsoft\Windows\DWM" = @{ 79 | "EnableAeroPeek" = 0 80 | "Composition" = 0 81 | } 82 | } 83 | 84 | foreach ($path in $visualSettings.Keys) { 85 | foreach ($key in $visualSettings[$path].Keys) { 86 | Set-ItemProperty -Path $path -Name $key -Value $visualSettings[$path][$key] -ErrorAction Stop 87 | } 88 | } 89 | } catch { 90 | Write-Host "Erro ao otimizar interface visual: $_" -ForegroundColor Yellow 91 | } 92 | 93 | # 2. Desativar serviços 94 | Write-Host "`n[2/10] Desativando serviços desnecessários..." -ForegroundColor Magenta 95 | $servicesToDisable = @( 96 | "XblAuthManager", "XblGameSave", "XboxNetApiSvc", "XboxGipSvc", 97 | "DiagTrack", "dmwappushservice", "DPS", "WdiServiceHost", 98 | "MapsBroker", "WMPNetworkSvc", "WwanSvc", 99 | "SysMain", "WSearch", "defragsvc", 100 | "Fax", "PrintNotify", 101 | "wuauserv", "DoSvc", "UsoSvc", "WaaSMedicSvc", 102 | "PcaSvc", "RetailDemo", "AppXSvc", 103 | "TabletInputService", "TouchKeyboard", 104 | "BcastDVRUserService_*", "GameDVR", 105 | "WerSvc", "TroubleShootingSvc", 106 | "lfsvc", "icssvc", "WalletService" 107 | ) 108 | Disable-Services -ServiceList $servicesToDisable 109 | 110 | # 3. Otimizar energia e memória 111 | Write-Host "`n[3/10] Configurando energia e memória..." -ForegroundColor Magenta 112 | try { 113 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Value 0 114 | powercfg /hibernate off 115 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "PagingFiles" -Value "" 116 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "LargeSystemCache" -Value 1 117 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "DisablePagingExecutive" -Value 1 118 | 119 | powercfg /duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 120 | powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 121 | powercfg /change standby-timeout-ac 0 122 | powercfg /change hibernate-timeout-ac 0 123 | powercfg /setacvalueindex SCHEME_CURRENT SUB_PROCESSOR PROCTHROTTLEMIN 100 124 | powercfg /setacvalueindex SCHEME_CURRENT SUB_PROCESSOR PROCTHROTTLEMAX 100 125 | powercfg /setacvalueindex SCHEME_CURRENT SUB_PROCESSOR IDLE 0 126 | } catch { 127 | Write-Host "Erro ao configurar energia e memória: $_" -ForegroundColor Yellow 128 | } 129 | 130 | # 4. Limpeza de arquivos 131 | Write-Host "`n[4/10] Realizando limpeza de arquivos..." -ForegroundColor Magenta 132 | $pathsToClean = @( 133 | "$env:TEMP\*", 134 | "C:\Windows\Temp\*", 135 | "C:\Windows\Prefetch\*", 136 | "C:\Windows\SoftwareDistribution\*", 137 | "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*", 138 | "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" 139 | ) 140 | foreach ($path in $pathsToClean) { 141 | try { 142 | Remove-Item -Path $path -Recurse -Force -ErrorAction Stop 143 | Write-Host "Limpeza concluída em: $path" -ForegroundColor Cyan 144 | } catch { 145 | Write-Host "Erro ao limpar $path : $_" -ForegroundColor Yellow 146 | } 147 | } 148 | Start-Process -FilePath "cleanmgr.exe" -ArgumentList "/sagerun:1" -NoNewWindow -Wait -ErrorAction SilentlyContinue 149 | 150 | # 5. Desativar tarefas agendadas 151 | Write-Host "`n[5/10] Desativando tarefas agendadas..." -ForegroundColor Magenta 152 | $tasksToDisable = @( 153 | "\Microsoft\Windows\Application Experience\*", 154 | "\Microsoft\Windows\Customer Experience Improvement Program\*", 155 | "\Microsoft\Windows\Defrag\*", 156 | "\Microsoft\Windows\Maintenance\*", 157 | "\Microsoft\Windows\Power Efficiency Diagnostics\*", 158 | "\Microsoft\Windows\WindowsUpdate\*", 159 | "\Microsoft\Windows\DiskCleanup\*", 160 | "\Microsoft\Windows\CloudExperienceHost\*", 161 | "\Microsoft\Windows\Feedback\*", 162 | "\Microsoft\Windows\Maps\*" 163 | ) 164 | foreach ($task in $tasksToDisable) { 165 | try { 166 | schtasks /change /tn $task /disable -ErrorAction Stop 167 | Write-Host "Tarefa $task desativada." -ForegroundColor Cyan 168 | } catch { 169 | Write-Host "Erro ao desativar tarefa $task : $_" -ForegroundColor Yellow 170 | } 171 | } 172 | 173 | # 6. Desativar recursos do Windows 174 | Write-Host "`n[6/10] Desativando recursos do Windows..." -ForegroundColor Magenta 175 | $featuresToDisable = @( 176 | "WindowsMediaFeatures", "Internet-Explorer-Optional-amd64", 177 | "Microsoft-Windows-Subsystem-Linux", "WorkFolders-Client", 178 | "Microsoft-Hyper-V-All", "Windows-Defender-Default-Definitions", 179 | "SMB1Protocol" 180 | ) 181 | Disable-Features -FeatureList $featuresToDisable 182 | 183 | # 7. Otimizar processador e rede 184 | Write-Host "`n[7/10] Otimizando processador e rede..." -ForegroundColor Magenta 185 | try { 186 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\54533251-82be-4824-96c1-47b60b740d00\0cc5b647-c1df-4637-891a-dec35c318583" -Name "Value" -Value 100 187 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" -Name "DisableBandwidthThrottling" -Value 1 188 | } catch { 189 | Write-Host "Erro ao otimizar processador e rede: $_" -ForegroundColor Yellow 190 | } 191 | 192 | # 8. Desativar notificações e telemetria 193 | Write-Host "`n[8/10] Desativando notificações e telemetria..." -ForegroundColor Magenta 194 | try { 195 | $notificationSettings = @{ 196 | "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" = @{ "ToastEnabled" = 0 } 197 | "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{ "ShowSyncProviderNotifications" = 0 } 198 | "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" = @{ "SystemPaneSuggestionsEnabled" = 0 } 199 | "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" = @{ "AllowTelemetry" = 0 } 200 | } 201 | 202 | foreach ($path in $notificationSettings.Keys) { 203 | foreach ($key in $notificationSettings[$path].Keys) { 204 | Set-ItemProperty -Path $path -Name $key -Value $notificationSettings[$path][$key] -ErrorAction Stop 205 | } 206 | } 207 | } catch { 208 | Write-Host "Erro ao desativar notificações e telemetria: $_" -ForegroundColor Yellow 209 | } 210 | 211 | # 9. Verificação do sistema 212 | Write-Host "`n[9/10] Verificando integridade do sistema..." -ForegroundColor Magenta 213 | try { 214 | Write-Host "Executando SFC..." -ForegroundColor Cyan 215 | sfc /scannow | Out-Null 216 | Write-Host "Executando DISM..." -ForegroundColor Cyan 217 | DISM /Online /Cleanup-Image /RestoreHealth | Out-Null 218 | } catch { 219 | Write-Host "Erro durante verificação do sistema: $_" -ForegroundColor Yellow 220 | } 221 | 222 | # 10. Finalização 223 | Write-Host "`n[10/10] Otimização concluída!" -ForegroundColor Green 224 | Write-Host "Reinicie o sistema para aplicar todas as mudanças." -ForegroundColor Yellow 225 | Write-Host "Pressione qualquer tecla para sair..." -ForegroundColor White 226 | $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 227 | --------------------------------------------------------------------------------