【AWS CLI】【SSM】全マネージドインスタンス(Windows)のサービス一覧が欲しい!

記事タイトルとURLをコピーする

こんにちは。AWS CLIが好きな福島です。

今回はタイトル通り、SSMで管理している全マネージドインスタンス(Windows)のサービス一覧を抽出するコマンドをご紹介いたします。

結論

  • 実行コマンド
aws ssm describe-instance-information --query "InstanceInformationList[?PlatformType=='Windows'].[ResourceType,InstanceId]" --output text | while read line
do
   echo "#############################################################"
   echo "### $line"
   echo "#############################################################"
   echo "Name?DisplayName?ServiceType?Status?StartType" > /tmp/awscli.tmp
   aws ssm list-inventory-entries --instance-id $(echo $line | awk '{print $2}') \
   --type-name AWS:Service --query "Entries[].[Name,DisplayName,ServiceType,Status,StartType]" \
   --output text | tr "\t" "?" >> /tmp/awscli.tmp;\
   column -s? -t /tmp/awscli.tmp
done ;\
rm /tmp/awscli.tmp
  • 実行結果
#############################################################
### EC2Instance i-0653ccf3e3a08c46b
#############################################################
Name                                      DisplayName                                                                                         ServiceType                         Status   StartType
AJRouter                                  AllJoyn Router Service                                                                              Win32ShareProcess                   Stopped  Manual
ALG                                       Application Layer Gateway Service                                                                   Win32OwnProcess                     Stopped  Manual
AmazonSSMAgent                            Amazon SSM Agent                                                                                    Win32OwnProcess                     Running  Automatic
AppHostSvc                                Application Host Helper Service                                                                     Win32OwnProcess, Win32ShareProcess  Running  Automatic
AppIDSvc                                  Application Identity                                                                                Win32ShareProcess                   Stopped  Manual
Appinfo                                   Application Information                                                                             Win32ShareProcess                   Stopped  Manual
AppMgmt                                   Application Management                                                                              Win32ShareProcess                   Stopped  Manual
AppReadiness                              App Readiness                                                                                       Win32ShareProcess                   Stopped  Manual
AppVClient                                Microsoft App-V Client                                                                              Win32OwnProcess                     Stopped  Disabled
AppXSvc                                   AppX Deployment Service (AppXSVC)                                                                   Win32ShareProcess                   Stopped  Manual
AudioEndpointBuilder                      Windows Audio Endpoint Builder                                                                      Win32ShareProcess                   Stopped  Manual
Audiosrv                                  Windows Audio                                                                                       Win32OwnProcess                     Stopped  Manual
AWSLiteAgent                              AWS Lite Guest Agent                                                                                Win32OwnProcess                     Stopped  Automatic
AxInstSV                                  ActiveX Installer (AxInstSV)                                                                        Win32ShareProcess                   Stopped  Disabled
BFE                                       Base Filtering Engine                                                                               Win32ShareProcess                   Running  Automatic
BITS                                      Background Intelligent Transfer Service                                                             Win32ShareProcess                   Stopped  Manual
BrokerInfrastructure                      Background Tasks Infrastructure Service                                                             Win32ShareProcess                   Running  Automatic
BTAGService                               Bluetooth オーディオ ゲートウェイ サービス                                                          Win32ShareProcess                   Stopped  Manual
BthAvctpSvc                               AVCTP サービス                                                                                      Win32ShareProcess                   Stopped  Manual
bthserv                                   Bluetooth サポート サービス                                                                         Win32ShareProcess                   Stopped  Manual
camsvc                                    機能アクセス マネージャー サービス                                                                  Win32ShareProcess                   Stopped  Manual
CDPSvc                                    Connected Devices Platform Service                                                                  Win32OwnProcess, Win32ShareProcess  Running  Automatic
CertPropSvc                               Certificate Propagation                                                                             Win32OwnProcess, Win32ShareProcess  Running  Manual
cfn-hup                                   CloudFormation cfn-hup                                                                              Win32OwnProcess                     Stopped  Manual
ClipSVC                                   Client License Service (ClipSVC)                                                                    Win32ShareProcess                   Stopped  Manual
COMSysApp                                 COM+ System Application                                                                             Win32OwnProcess                     Stopped  Manual
CoreMessagingRegistrar                    CoreMessaging                                                                                       Win32ShareProcess                   Running  Automatic
CryptSvc                                  Cryptographic Services                                                                              Win32OwnProcess, Win32ShareProcess  Running  Automatic
CscService                                Offline Files                                                                                       Win32ShareProcess                   Stopped  Disabled
DcomLaunch                                DCOM Server Process Launcher                                                                        Win32ShareProcess                   Running  Automatic
defragsvc                                 Optimize drives                                                                                     Win32OwnProcess                     Stopped  Manual
DeviceAssociationService                  Device Association Service                                                                          Win32ShareProcess                   Stopped  Manual
DeviceInstall                             Device Install Service                                                                              Win32ShareProcess                   Stopped  Manual
DevQueryBroker                            DevQuery Background Discovery Broker                                                                Win32ShareProcess                   Stopped  Manual
Dhcp                                      DHCP Client                                                                                         Win32OwnProcess, Win32ShareProcess  Running  Automatic
diagnosticshub.standardcollector.service  Microsoft (R) 診断ハブ標準コレクター サービス                                                       Win32OwnProcess                     Stopped  Manual
DiagTrack                                 Connected User Experiences and Telemetry                                                            Win32OwnProcess                     Stopped  Disabled
DmEnrollmentSvc                           デバイス管理登録サービス                                                                            Win32OwnProcess                     Stopped  Manual
dmwappushservice                          デバイス管理ワイヤレス アプリケーション プロトコル (WAP) プッシュ メッセージ ルーティング サービス  Win32ShareProcess                   Stopped  Disabled
Dnscache                                  DNS Client                                                                                          Win32OwnProcess, Win32ShareProcess  Running  Automatic
DoSvc                                     Delivery Optimization                                                                               Win32OwnProcess, Win32ShareProcess  Stopped  Manual
dot3svc                                   Wired AutoConfig                                                                                    Win32ShareProcess                   Stopped  Manual
DPS                                       Diagnostic Policy Service                                                                           Win32OwnProcess, Win32ShareProcess  Running  Automatic
ds_agent                                  Trend Micro Deep Security Agent                                                                     Win32OwnProcess                     Running  Automatic
ds_monitor                                Trend Micro Deep Security Monitor                                                                   Win32OwnProcess                     Running  Automatic
ds_notifier                               Trend Micro Deep Security Notifier                                                                  Win32OwnProcess                     Running  Automatic
DsmSvc                                    Device Setup Manager                                                                                Win32OwnProcess, Win32ShareProcess  Stopped  Manual
DsSvc                                     Data Sharing Service                                                                                Win32OwnProcess, Win32ShareProcess  Running  Manual
Eaphost                                   Extensible Authentication Protocol                                                                  Win32ShareProcess                   Stopped  Manual
EFS                                       Encrypting File System (EFS)                                                                        Win32ShareProcess                   Stopped  Manual

備考

本来は、DependentServices,ServicesDependedOnという項目も表示できますが、左記の項目に入る値は長く表示が分かりにくくなるため、抜いております。 一応、DependentServices,ServicesDependedOnという項目も含めたコマンドも記載しております。

  • 実行コマンド
aws ssm describe-instance-information --query "InstanceInformationList[?PlatformType=='Windows'].[ResourceType,InstanceId]" --output text | while read line
do
   echo "#############################################################"
   echo "### $line"
   echo "#############################################################"
   echo "Name?DisplayName?ServiceType?Status?StartType?DependentServices?ServicesDependedOn" > /tmp/awscli.tmp
   aws ssm list-inventory-entries --instance-id $(echo $line | awk '{print $2}') --type-name AWS:Service --query "Entries[].[Name,DisplayName,ServiceType,Status,StartType,DependentServices,ServicesDependedOn]" --output text | tr "\t" "?" >> /tmp/awscli.tmp
   column -s? -t /tmp/awscli.tmp
done ;\
rm  > /tmp/awscli.tmp
  • 実行結果
#############################################################
### EC2Instance i-0653ccf3e3a08c46b
#############################################################
Name                                      DisplayName                                                                                         ServiceType                         Status   StartType  DependentServices                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ServicesDependedOn
AJRouter                                  AllJoyn Router Service                                                                              Win32ShareProcess                   Stopped  Manual
ALG                                       Application Layer Gateway Service                                                                   Win32OwnProcess                     Stopped  Manual
AmazonSSMAgent                            Amazon SSM Agent                                                                                    Win32OwnProcess                     Running  Automatic
AppHostSvc                                Application Host Helper Service                                                                     Win32OwnProcess, Win32ShareProcess  Running  Automatic
AppIDSvc                                  Application Identity                                                                                Win32ShareProcess                   Stopped  Manual     applockerfltr                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          RpcSs CryptSvc AppID
Appinfo                                   Application Information                                                                             Win32ShareProcess                   Stopped  Manual     RpcSs ProfSvc
AppMgmt                                   Application Management                                                                              Win32ShareProcess                   Stopped  Manual
AppReadiness                              App Readiness                                                                                       Win32ShareProcess                   Stopped  Manual
AppVClient                                Microsoft App-V Client                                                                              Win32OwnProcess                     Stopped  Disabled   AppvVfs RpcSS AppvStrm netprofm
AppXSvc                                   AppX Deployment Service (AppXSVC)                                                                   Win32ShareProcess                   Stopped  Manual     rpcss staterepository
AudioEndpointBuilder                      Windows Audio Endpoint Builder                                                                      Win32ShareProcess                   Stopped  Manual     Audiosrv
Audiosrv                                  Windows Audio                                                                                       Win32OwnProcess                     Stopped  Manual     AudioEndpointBuilder RpcSs
AWSLiteAgent                              AWS Lite Guest Agent                                                                                Win32OwnProcess                     Stopped  Automatic
AxInstSV                                  ActiveX Installer (AxInstSV)                                                                        Win32ShareProcess                   Stopped  Disabled   rpcss
BFE                                       Base Filtering Engine                                                                               Win32ShareProcess                   Running  Automatic  WdNisSvc WdNisDrv SharedAccess RemoteAccess PolicyAgent NcaSvc mpssvc IKEEXT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           RpcSs
BITS                                      Background Intelligent Transfer Service                                                             Win32ShareProcess                   Stopped  Manual     RpcSs
BrokerInfrastructure                      Background Tasks Infrastructure Service                                                             Win32ShareProcess                   Running  Automatic  WMPNetworkSvc WSearch embeddedmode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     DcomLaunch RpcSs RpcEptMapper
BTAGService                               Bluetooth オーディオ ゲートウェイ サービス                                                          Win32ShareProcess                   Stopped  Manual     rpcss bthserv
BthAvctpSvc                               AVCTP サービス                                                                                      Win32ShareProcess                   Stopped  Manual     rpcss
bthserv                                   Bluetooth サポート サービス                                                                         Win32ShareProcess                   Stopped  Manual     BTAGService
camsvc                                    機能アクセス マネージャー サービス                                                                  Win32ShareProcess                   Stopped  Manual
CDPSvc                                    Connected Devices Platform Service                                                                  Win32OwnProcess, Win32ShareProcess  Running  Automatic  Tcpip ncbservice RpcSS
CertPropSvc                               Certificate Propagation                                                                             Win32OwnProcess, Win32ShareProcess  Running  Manual     RpcSs
cfn-hup                                   CloudFormation cfn-hup                                                                              Win32OwnProcess                     Stopped  Manual
ClipSVC                                   Client License Service (ClipSVC)                                                                    Win32ShareProcess                   Stopped  Manual     rpcss
COMSysApp                                 COM+ System Application                                                                             Win32OwnProcess                     Stopped  Manual     EventSystem SENS RpcSs
CoreMessagingRegistrar                    CoreMessaging                                                                                       Win32ShareProcess                   Running  Automatic  rpcss
CryptSvc                                  Cryptographic Services                                                                              Win32OwnProcess, Win32ShareProcess  Running  Automatic  applockerfltr AppIDSvc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 RpcSs
CscService                                Offline Files                                                                                       Win32ShareProcess                   Stopped  Disabled   RpcSs
DcomLaunch                                DCOM Server Process Launcher                                                                        Win32ShareProcess                   Running  Automatic  wuauserv WMPNetworkSvc WSearch WpnService WPDBusEnum wlidsvc wisvc WinRM UALSVC NcaSvc iphlpsvc ds_notifier ds_agent Winmgmt WinDefend WiaRpc WEPHOSTSVC icssvc Wcmsvc WbioSrvc W3SVC WAS WaaSMedicSvc VSS vds VaultSvc UsoSvc TokenBroker UserManager TrkWks UmRdpService TermService tapisrv TabletInputService Schedule SystemEventsBroker SysMain swprv stisvc AppXSvc StateRepository sppsvc Spooler smphost shpamsvc ShellHWDetection SgrmBroker SessionEnv SEMgrSvc SecurityHealthService SCPolicySvc MSDTC LanmanServer KtmRm SamSs RSoPProv RmSvc RemoteRegistry RemoteAccess QWAVE PushToInstall Appinfo ProfSvc PrintWorkflowUserSvc PrintNotify pla PhoneSvc PerfHost PcaSvc upnphost SSDPSRV AppVClient netprofm NlaSvc Netman Netlogon LanmanWorkstation IKEEXT RasMan Dnscache WinHttpAutoProxySvc Dhcp nsi NgcSvc NgcCtnrSvc NetSetupSvc CDPSvc NcbService msiserver MapsBroker LSM lltdsvc LicenseManager lfsvc KPSSVC dot3svc Eaphost KeyIso InstallService gpsvc FrameServer FDResPub fdPHost COMSysApp SENS EventSystem EntAppSvc EFS DsmSvc DoSvc dmwappushservice DmEnrollmentSvc DiagTrack DevicesFlowUserSvc DevicePickerUserSvc defragsvc CscService applockerfltr AppIDSvc CryptSvc CoreMessagingRegistrar ConsentUxUserSvc ClipSVC CertPropSvc CaptureService BthAvctpSvc BTAGService embeddedmode BrokerInfrastructure BITS WdNisSvc WdNisDrv SharedAccess PolicyAgent mpssvc BFE AxInstSV Audiosrv RpcSs
defragsvc                                 Optimize drives                                                                                     Win32OwnProcess                     Stopped  Manual     RPCSS
DeviceAssociationService                  Device Association Service                                                                          Win32ShareProcess                   Stopped  Manual
DeviceInstall                             Device Install Service                                                                              Win32ShareProcess                   Stopped  Manual
DevQueryBroker                            DevQuery Background Discovery Broker                                                                Win32ShareProcess                   Stopped  Manual
Dhcp                                      DHCP Client                                                                                         Win32OwnProcess, Win32ShareProcess  Running  Automatic  NcaSvc iphlpsvc WinHttpAutoProxySvc AppVClient netprofm NlaSvc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Afd NSI
diagnosticshub.standardcollector.service  Microsoft (R) 診断ハブ標準コレクター サービス                                                       Win32OwnProcess                     Stopped  Manual
DiagTrack                                 Connected User Experiences and Telemetry                                                            Win32OwnProcess                     Stopped  Disabled   RpcSs
DmEnrollmentSvc                           デバイス管理登録サービス                                                                            Win32OwnProcess                     Stopped  Manual     rpcss
dmwappushservice                          デバイス管理ワイヤレス アプリケーション プロトコル (WAP) プッシュ メッセージ ルーティング サービス  Win32ShareProcess                   Stopped  Disabled   rpcss
Dnscache                                  DNS Client                                                                                          Win32OwnProcess, Win32ShareProcess  Running  Automatic  RemoteAccess RasMan NcaSvc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             nsi
DoSvc                                     Delivery Optimization                                                                               Win32OwnProcess, Win32ShareProcess  Stopped  Manual     rpcss
dot3svc                                   Wired AutoConfig                                                                                    Win32ShareProcess                   Stopped  Manual     RpcSs Eaphost Ndisuio
DPS                                       Diagnostic Policy Service                                                                           Win32OwnProcess, Win32ShareProcess  Running  Automatic
ds_agent                                  Trend Micro Deep Security Agent                                                                     Win32OwnProcess                     Running  Automatic  Netman Winmgmt
ds_monitor                                Trend Micro Deep Security Monitor                                                                   Win32OwnProcess                     Running  Automatic
ds_notifier                               Trend Micro Deep Security Notifier                                                                  Win32OwnProcess                     Running  Automatic  Netman Winmgmt
DsmSvc                                    Device Setup Manager                                                                                Win32OwnProcess, Win32ShareProcess  Stopped  Manual     RpcSs
DsSvc                                     Data Sharing Service                                                                                Win32OwnProcess, Win32ShareProcess  Running  Manual
Eaphost                                   Extensible Authentication Protocol                                                                  Win32ShareProcess                   Stopped  Manual     dot3svc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                RPCSS KeyIso
EFS                                       Encrypting File System (EFS)                                                                        Win32ShareProcess                   Stopped  Manual     RPCSS

終わりに

今回は、全マネージドインスタンス(Windows)のサービス一覧を出力するコマンドをご紹介いたしました。 どなたかのお役に立てれば幸いです。

福島 和弥 (記事一覧)

2019/10 入社

AWS CLIが好きです。

AWS資格12冠。2023 Japan AWS Partner Ambassador/APN ALL AWS Certifications Engineer。