如何通过 PowerShell 根据启动类型获取服务?


以下命令可用于根据服务启动类型(自动、手动或禁用)筛选服务。

命令

获取自动启动服务。这些服务会在系统启动时自动启动。

Get-Service | where{$_.StartType -eq "Automatic"} | Select Name, Starttype

输出

SystemEventsBroker          Automatic
TeraCopyService             Automatic
Themes                      Automatic
TrkWks                      Automatic
UserManager                 Automatic
UsoSvc                      Automatic
VMUSBArbService             Automatic
WavesSysSvc                 Automatic
Wcmsvc                      Automatic
Winmgmt                     Automatic
WlanSvc                     Automatic
WpnService                  Automatic
WpnUserService_158379       Automatic
wscsvc                      Automatic
WSearch                     Automatic
ZeroConfigService           Automatic

命令

获取手动启动服务。这些服务需要手动启动,不会在系统启动时自动启动。它们可以由用户或应用程序触发启动。

Get-Service | where{$_.StartType -eq "Manual"} | Select Name, Starttype

输出

WinRM                                                     Manual
wisvc                                                     Manual
wlidsvc                                                   Manual
wlpasvc                                                   Manual
WManSvc                                                   Manual
wmiApSrv                                                  Manual
WMPNetworkSvc                                             Manual
workfolderssvc                                            Manual
WpcMonSvc                                                 Manual
WPDBusEnum                                                Manual

命令

获取禁用启动服务。当这些类型的服务不再有用时,它们会被用户或系统管理员禁用。

Get-Service | where{$_.StartType -eq "Disabled"} | Select Name, Starttype

输出

Name              StartType
----              ---------
AppVClient         Disabled
NetTcpPortSharing  Disabled
RemoteAccess       Disabled
RemoteRegistry     Disabled
shpamsvc           Disabled
ssh-agent          Disabled
svcdemo            Disabled
tzautoupdate       Disabled
UevAgentService    Disabled

更新于: 2020-01-22

3K+ 浏览次数

启动你的职业

完成课程以获得认证

开始
广告
© . All rights reserved.