getting description from process Tab in Task Manager in windows 2008 64 R2

Posted on 2012-08-31
Last Modified: 2012-09-09
how can i get the description for a process since i have used the code below it does not give what is displayed in task manager

Dim objWMIService,colProcess, objProcess
objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Me.lstServers.SelectedItem.ToString & "\root\cimv2")
        colProcess = objWMIService.ExecQuery("SELECT * FROM Win32_Process")

For Each objProcess In colProcess

It gives me most of the other information but not that one.

Thank You.
Question by:mphillip85
    LVL 5

    Expert Comment

    Use powershell instead:
    get-process | select name,description

    Open in new window

    To see everything you can query:
    get-process | select *

    Open in new window


    Author Comment

    i need this to be in or vb.script code

    thank you
    LVL 10

    Expert Comment

    LVL 20

    Accepted Solution

    since you mention and it appears that is what you are really coding in you can use the Process.GetProcess function.  The one warning here is that you can run into Access denied errors on some of the restricted items and need to account for that in code.  You can adjust your code snippet using the concepts here:

    For Each processitem As Process In Process.GetProcesses
    		Dim strDescription As String = processitem.MainModule.FileVersionInfo.FileDescription
    	Catch exWin32 As System.ComponentModel.Win32Exception
    		Debug.Print("Access was Denied How Do you want to handle that?")
    	Catch ex As Exception
    		Debug.Print("Other Errors")
    	End Try

    Open in new window


    Author Comment

    thank you i will try this and see what happens.
    LVL 5

    Expert Comment

    I only recommend Powershell because you can still code VB within it, but you can get the features of Powershell as well.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
    What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now