2
3

Windowsでサービスの無効化をコマンド(bat)で設定

Last updated at Posted at 2023-05-15

概要

「PCが重たい」といった時に不要サービスを止める対応をしている。

でも1つ1つのサービスに対して下記画面を開くのが面倒。
image.png

よく無効化するサービスはコマンド(bat)で一気に設定したい。
コマンド(bat)化によって、『設定漏れ』『設定間違い』の可能性も減らせる。

やり方

コマンドプロンプトで実行する際は、コマンドプロンプトを管理者権限で開く必要あり。

サービス無効化コマンド
sc config "サービス名" start= disabled

無効化が成功すれば下記。
image.png

サービス名の確認方法

『サービス名』と『表示名』を混同しないように注意。
image.png
image.png

既に無効化されている場合

下記の状態で…
image.png

下記を実行すると…

sc config "AxInstSV" start= disabled

例外は起きずに成功。
image.png

サービスが実行中の場合

下記の状態で…
image.png

下記を実行すると…

sc config "Spooler" start= disabled

例外は起きずに成功。
image.png

起動状態はそのまま でスタートアップが無効になる。
image.png

起動状態には影響しない。
あくまでスタートアップの設定が変わるのみ。

コピペ用

  1. テキストエディタにコピペ。
  2. 無効化したくないサービスに対するコマンドは削除。
  3. 上記をコマンドプロンプトにコピペで実行。(空行は気にしなくてOK)
rem 不要サービス無効化

rem ActiveX Installer
rem ActiveX使うアプリ無ければ。
sc config "AxInstSV" start= disabled

rem Bluetooth オーディオゲートウェイサービス
sc config "BTAGService" start= disabled

rem Bluetooth サポートサービス
sc config "bthserv" start= disabled

rem Bluetooth ユーザー サポート サービス_55343
rem 無効化できない場合はレジストリーを直接変更。
sc config "BluetoothUserService_55343" start= disabled

rem Connected User Experiences and Telemetry
rem Microsoftに情報送るやつ。
sc config "DiagTrack" start= disabled

rem Function Discovery Provider Host
rem ネットワーク探索のやつ。
sc config "fdPHost" start= disabled

rem Function Discovery Resource Publication
rem ネットワーク探索のやつ。
sc config "FDResPub" start= disabled

rem Geolocation Service
rem 位置情報をアプリに提供するやつ。
sc config "lfsvc" start= disabled

rem Print Spooler
rem プリンターを全く使わない用途なら。
sc config "Spooler" start= disabled

rem SSDP Discovery
sc config "SSDPSRV" start= disabled

rem Windows Error Reporting Service
sc config "WerSvc" start= disabled

rem Windows Media Player Network Sharing Service
sc config "WMPNetworkSvc" start= disabled

rem Xbox Accessory Management Service
sc config "XboxGipSvc" start= disabled

rem Xbox Live Auth Manager
sc config "XblAuthManager" start= disabled

rem Xbox Live セーブ データ
sc config "XblGameSave" start= disabled

rem Xbox Live ネットワーキング サービス
sc config "XboxNetApiSvc" start= disabled

rem Diagnostic Policy Service
sc config "DPS" start= disabled

Bluetooth ユーザーサポートサービス_XXX

『XXX』の部分は任意に読み替え。

UIから無効にしようとすると、下記でできない。
image.png

レジストリエディタで下記へ行って…

4aa3ceの場合
コンピューター\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BluetoothUserService_4aa3ce

下記のようにStartを4にすれば無効化できる。
image.png

参考サイトさん

バージョン

Windows 10 Pro 22H2 19045.2965

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3