若要查看指定计算机上所有服务的状态,可以本地使用 Get-Service cmdlet。 对于远程系统,可以使用 Win32_Service WMI 类 。 如果还使用 Select-Object 来筛选 Status、Name 和 DisplayName 的结果,则输出格式将与 Get-Service 的输出格式几乎完全相同 :
PS C:/Users/maxsu> Get-CimInstance -ClassName Win32_Service | Select-Object -Property Status,Name,DisplayName
Status Name DisplayName
------ ---- -----------
OK AJRouter AllJoyn Router Service
OK ALG Application Layer Gateway Service
OK AppIDSvc Application Identity
OK Appinfo Application Information
OK Apple Mobile Device Service Apple Mobile Device Service
OK AppReadiness App Readiness
OK AppXSvc AppX Deployment Service (AppXSVC)
OK aspnet_state ASP.NET State Service
OK AtherosSvc AtherosSvc
OK AudioEndpointBuilder Windows Audio Endpoint Builder
OK Audiosrv Windows Audio
OK autotimesvc 手机网络时间
OK AxInstSV ActiveX Installer (AxInstSV)
OK BDESVC BitLocker Drive Encryption Service
OK BFE Base Filtering Engine
OK BITS Background Intelligent Transfer Service
OK BrokerInfrastructure Background Tasks Infrastructure Service
OK BTAGService 蓝牙音频网关服务
OK BthAvctpSvc AVCTP 服务
OK bthserv 蓝牙支持服务
OK camsvc 功能访问管理器服务
OK CDPSvc 连接设备平台服务
OK CertPropSvc Certificate Propagation
OK ClipSVC Client License Service (ClipSVC)
OK COMSysApp COM+ System Application
若要完整显示具有极长名称的临时服务的名称,可能需要使用具有 AutoSize 和 Wrap 参数的 Format-Table,用于优化列宽并允许较长名称换行而不是被截断 :
PS C:/Users/maxsu> Get-CimInstance -ClassName Win32_Service | Format-Table -Property Status,Name,DisplayName -AutoSize -Wrap
Status Name DisplayName
------ ---- -----------
OK AJRouter AllJoyn Router Service
OK ALG Application Layer Gateway Service
OK AppIDSvc Application Identity
OK Appinfo Application Information
OK Apple Mobile Device Service Apple Mobile Device Service
OK AppReadiness App Readiness
OK AppXSvc AppX Deployment Service (AppXSVC)
OK aspnet_state ASP.NET State Service
OK AtherosSvc AtherosSvc
OK AudioEndpointBuilder Windows Audio Endpoint Builder
OK Audiosrv Windows Audio
OK autotimesvc 手机网络时间
... ...
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266804.html