Windowsサービスの一覧を取得する方法について記載しています。
次のコマンドを実行します。
get-service
実行結果
Status Name DisplayName
------ ---- -----------
Running AdobeARMservice Adobe Acrobat Update Service
Stopped AJRouter AllJoyn Router Service
Stopped ALG Application Layer Gateway Service
Stopped AppIDSvc Application Identity
Stopped Appinfo Application Information
Stopped AppMgmt Application Management
Stopped AppReadiness App Readiness
Stopped AppVClient Microsoft App-V Client
Stopped AppXSvc AppX Deployment Service (AppXSVC)
Stopped AssignedAccessM... AssignedAccessManager サービス
Running AudioEndpointBu... Windows Audio Endpoint Builder
Running Audiosrv Windows Audio
...省略
構成管理としては、「説明」は表示不要で、「スタートアップ種類」と「名前」を取得したいです。
それから表示内容が切れているのも修正します。
以上の内容で出力する場合、次のコマンドを実行します。
get-service | select-object displayname,name,status,starttype
実行結果
DisplayName Name Status StartType
----------- ---- ------ ---------
Adobe Acrobat Update Service AdobeARMservice Running Automatic
AllJoyn Router Service AJRouter Stopped Manual
Application Layer Gateway Service ALG Stopped Manual
Application Identity AppIDSvc Stopped Manual
Application Information Appinfo Stopped Manual
Application Management AppMgmt Stopped Manual
App Readiness AppReadiness Stopped Manual
Microsoft App-V Client AppVClient Stopped Disabled
AppX Deployment Service (AppXSVC) AppXSvc Stopped Manual
AssignedAccessManager サービス AssignedAccessManagerSvc Stopped Manual
Windows Audio Endpoint Builder AudioEndpointBuilder Running Automatic
Windows Audio Audiosrv Running Automatic
...省略
ファイルに出力する場合、次のコマンドを実行します。
get-service | select-object displayname,name,status,starttype | Export-Csv -encoding Default service.csv