Skip to content

Instantly share code, notes, and snippets.

@uzulla
Last active April 15, 2025 23:32
Show Gist options
  • Save uzulla/85050f45eb3676520fe7c2d28a725c74 to your computer and use it in GitHub Desktop.
Save uzulla/85050f45eb3676520fe7c2d28a725c74 to your computer and use it in GitHub Desktop.
Windowsで不要とされるサービスを停止(手動化)して高速化(できるかもしれない)スクリプト、当然無保証
# 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 "すべての設定が完了しました。"
@uzulla
Copy link
Author

uzulla commented Apr 15, 2025

https://www.xda-developers.com/services-disabled-improve-windows-performance/
をみて、トライしてみたかったが面倒だったのでスクリプト化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment