任何人都有一个很好的技巧(用Python)来检测配置了启动类型为“自动(延迟启动)”的Windows服务?
我认为WMI会是一条路,但配置为“自动”和“自动(延迟启动)”的服务都显示为“自动”的启动模式。
例如,在使用Services.msc的本地Windows 7框中,我看到“Windows Update”配置为“自动(延迟启动)”,但WMI仅显示为“自动”:
>>> c = wmi.WMI()
>>> local = c.Win32_Service(Caption='Windows Update')
>>> len(local)
1
>>> print local[0]
instance of Win32_Service
{
AcceptPause = FALSE;
AcceptStop = TRUE;
Caption = "Windows Update";
CheckPoint = 0;
CreationClassName = "Win32_Service";
Description = "Enables the... ...(WUA) API.";
DesktopInteract = FALSE;
DisplayName = "Windows Update";
ErrorControl = "Normal";
ExitCode = 0;
Name = "wuauserv";
PathName = "C:\\Windows\\system32\\svchost.exe -k netsvcs";
ProcessId = 128;
ServiceSpecificExitCode = 0;
ServiceType = "Share Process";
Started = TRUE;
StartMode = "Auto";
StartName = "LocalSystem";
State = "Running";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "MEMYSELFANDI";
TagId = 0;
WaitHint = 0;
};
>>> local[0].StartMode
u'Auto'我欢迎任何建议。
干杯,
抢