A netizen asked:
select * from win32_ Service can check the service name and status
But I want to check whether the manufacturers of this service, such as Microsoft and Agricultural Bank of China, are still unknown?? What is this attribute? Thank you
I found something visible in msconfig, but I couldn’t extract it
The following is an indirect solution:
Obtain the associated main program according to the service name, and then obtain the manufacturer from the main program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
Set objWMIService = GetObject( "winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2" ) Set Services = objWMIService.ExecQuery( "Select * from Win32_Service" ) Set fso = CreateObject( "Scripting.FileSystemObject" ) Set objShell = CreateObject( "Shell.Application" ) Set objFolder = objShell.NameSpace(0) i = 0 Do If objFolder.GetDetailsOf( "" , i) = "Company" Then 'modified by non Chinese system Exit Do Else i = i+1 End If Loop For Each objService in Services path = GetPath(objService.PathName) IF fso.GetExtensionName(path) = "" Then path = path & ".exe" Set objFolder = objShell.NameSpace(fso.GetParentFolderName(path)) Set objItem = objFolder.ParseName(fso.GetFileName(path)) comp = objFolder.GetDetailsOf(objItem, i) If comp = "" Then comp = "Unknown" info = info & Service: & objService.DisplayName & Manufacturer: & comp & vbCrLF Next fso.CreateTextFile( "info.txt" , true).WriteLine info MsgBox "Done" Function GetPath(strng) Dim re Set re = New RegExp re.Pattern = "^" "?(.+\\[^\\\s" "]+).*" GetPath = re.Replace(strng, "$1" ) Set regEx = Nothing End Function |
Is it a very good solution? Little friends can learn it.