如何使用PowerShell使用WMI方法获取服务信息?
您也可以使用WMI方法代替标准命令Get-Service来获取服务信息。
命令
要在服务器上获取服务信息,您需要使用WMI类Win32_Service。
Get-WmiObject -Class Win32_Service
输出结果
ExitCode : 0 Name : Browser ProcessId : 0 StartMode : Manual State : Stopped Status : OK ExitCode : 0 Name : BTAGService ProcessId : 1468 StartMode : Manual State : Running Status : OK ExitCode : 0 Name : BthAvctpSvc ProcessId : 1460 StartMode : Manual State : Running Status : OK ExitCode : 0 Name : bthserv ProcessId : 1480 StartMode : Manual State : Running Status : OK
命令
您可以使用Select-Object过滤特定的输出。
Get-WmiObject win32_Service | Select-Object Name, State, Startmode
输出结果
Name State Startmode ---- ----- --------- AdobeARMservice Running Auto AdobeFlashPlayerUpdateSvc Stopped Manual AJRouter Stopped Manual ALG Stopped Manual AppIDSvc Stopped Manual Appinfo Running Manual AppMgmt Stopped Manual AppReadiness Stopped Manual AppVClient Stopped Disabled AppXSvc Stopped Manual AssignedAccessManagerSvc Stopped Manual AudioEndpointBuilder Running Auto Audiosrv Running Auto autotimesvc Stopped Manual AVP20.0 Running Auto AxInstSV Stopped Manual BDESVC Stopped Manual BFE Running Auto BITS Running Auto Bluetooth Device Monitor Running Auto Bluetooth OBEX Service Running Auto
使用WMI在远程计算机上获取服务。
Get-WmiObject win32_Service –ComputerName Win7,Test-PC | Select- Object Name, State, Startmode
热门推荐
10 死人新年祝福语简短句
11 节前送温暖祝福语简短
12 请灵回向祝福语简短
13 生日祝福语男孩 简短独特
14 新年留言老师祝福语简短
15 孙媳妇祝福语简短
16 致姐姐生日祝福语简短
17 老考试顺利祝福语简短
18 企业励志拜年祝福语简短