1

Been lookin' for a way to list the non-Microsoft Services to a *.txt file.

Either using vbs or a batch file will be sufficient.

I've tried numerous ways with WMI and the sc.exe command, but can't seem to put my finger on it.

Thanks,

Tim

2
  • 1
    what makes a service non-microsoft? Dec 8, 2009 at 8:43
  • The ones that aren't manufactured by MS ? Go to MSConfig > Services tab. And check the box at the bottom 'Hide All Microsoft Services'
    – user226973
    Dec 8, 2009 at 9:18

1 Answer 1

2

The Win32_Service WMI class doesn't have a property that would return the service's manufacturer, but the CIM_DataFile class does. So I can suggest the following solution:

  • Query and enumerate the Win32_Service class instances.
  • In the loop:
    1. Obtain the PathName property of the current service (it holds the command line for the service).
    2. Extract the service's file name from the PathName.
    3. Obtain the CIM_DataFile class instance corresponding to the service file.
    4. Check the file's Manufacturer property to find out whether or not the service is Microsoft's. For example, on my Vista box, the Manufacturer of all Microsoft services is Microsoft Corporation.

Notes:

  • Some magic may be required when parsing the PathName and querying the CIM_DataFile class as the PathName can include command-line arguments and may not include known file extensions (e.g. exe).
  • The Manufacturer property may be Null for some non-Microsoft services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.