如何在 PowerShell 中根据服务的状态获取所有服务?


以下命令将根据服务的状态筛选服务(正在运行,已停止)

命令

获取本地计算机上的所有**正在运行**的服务。

Get-Service | where{$_.Status -eq "Running"}

输出

Running  TimeBrokerSvc      Time Broker
Running  TokenBroker        Web Account Manager
Running  TrkWks             Distributed Link Tracking Client
Running  UnistoreSvc_158379 User Data Storage_158379
Running  UserDataSvc_158379 User Data Access_158379
Running  UserManager        User Manager
Running  UsoSvc             Update Orchestrator Service
Running  VaultSvc           Credential Manager
Running  VMUSBArbService    VMware USB Arbitration Service
Running  WavesSysSvc        Waves Audio Services
Running  WbioSrvc           Windows Biometric Service

命令

获取本地计算机上的所有**已停止**的服务。

Get-Service | where{$_.Status -eq "Stopped"}

输出

Stopped  vmicvss            Hyper-V Volume Shadow Copy Requestor
Stopped  VSS                Volume Shadow Copy
Stopped  VSStandardColle... Visual Studio Standard Collector Se...
Stopped  W32Time            Windows Time
Stopped  WaaSMedicSvc       Windows Update Medic Service
Stopped  WalletService      WalletService
Stopped  WarpJITSvc         WarpJITSvc
Stopped  wbengine           Block Level Backup Engine Service
Stopped  wcncsvc            Windows Connect Now - Config Registrar
Stopped  WdNisSvc           Windows Defender Antivirus Network ...
Stopped  Wecsvc             Windows Event Collector
Stopped  WEPHOSTSVC         Windows Encryption Provider Host Se...

更新于:2020 年 1 月 22 日

逾 1000 次浏览

开启您的 职业生涯

通过完成课程获得认证

开始
广告