Last active
April 15, 2025 23:32
-
-
Save uzulla/85050f45eb3676520fe7c2d28a725c74 to your computer and use it in GitHub Desktop.
Windowsで不要とされるサービスを停止(手動化)して高速化(できるかもしれない)スクリプト、当然無保証
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell 5では動作しません、PowerShell7をインストールして管理者権限で実行してください | |
# 例: | |
# winget install Microsoft.PowerShell | |
# PowerShell7を管理者権限で起動し… | |
# .\disable_useless_services.ps1 | |
# 管理者権限の確認 | |
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Write-Host "このスクリプトは管理者権限で実行する必要があります。" | |
exit | |
} | |
# サービスを「手動」に設定し、動作中の場合は停止する | |
$servicesToManual = @("WSearch", "SysMain", "TermService", "DiagTrack", "Spooler") | |
foreach ($service in $servicesToManual) { | |
try { | |
Set-Service -Name $service -StartupType Manual | |
$svc = Get-Service -Name $service | |
if ($svc.Status -eq 'Running') { | |
Stop-Service -Name $service | |
} | |
Write-Host "サービス $service を「手動」に設定し、停止しました。" | |
} catch { | |
Write-Host "サービス $service の設定に失敗しました: $_" | |
} | |
} | |
# Windows Update Delivery Optimizationを無効化 | |
$regPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" | |
if (-not (Test-Path $regPath)) { | |
New-Item -Path $regPath -Force | |
} | |
Set-ItemProperty -Path $regPath -Name "DODownloadMode" -Value 0 -Type DWord | |
Write-Host "Windows Update Delivery Optimizationを無効化しました。" | |
Write-Host "すべての設定が完了しました。" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.xda-developers.com/services-disabled-improve-windows-performance/
をみて、トライしてみたかったが面倒だったのでスクリプト化