VBS implements the query service manufacturer _vbs

Source: Internet
Author: User

A netizen asks a question:

SELECT * FROM Win32_Service this can check service name, status ...

But I would like to check the service manufacturers, such as Microsoft, Agricultural Bank, or unknown?? What this attribute is, thank you ...

I found what I could see in the Msconfig, but I couldn't extract it.

Here's an indirect approach to the answer:

Gets the associated main program based on the service name, and then gets the manufacturer from the main program

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 ' non-Chinese system modifies 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 & "Services:" &A mp Objservice.displayname & "Manufacturer:" & comp & VbCrLF Next fso. CreateTextFile ("Info.txt", true). WriteLine info MsgBox "complete" Function GetPath (strng) Dim re Set re = New RegExp re. Pattern = "^" "? (. +\\[^\\\s""]+). * "GetPath = Re.
 Replace (STRNG, "$") Set regEx = Nothing End Function

is not a very good solution, the small partners can learn.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.