Getting the w3wp.exe Process ID for Attach to Process

This is pretty well known and lots of others have posted about it over the years, but for the sake of completeness for those who read the last post and don’t know this already…

Often when you try to attach to the w3wp.exe process and debug an assembly there are multiple instances from which to choose. How do you know which one to pick?

Open a command prompt and run the iisapp.vbs script with no parameters as follows:

It will output a list of the currently running application pools and the associated PIDs.

Author: Doug Ware

Atlanta based entrepreneur, author of many SharePoint books and videos, leader of Atlanta .NET user group, founder of InstantQuick, and SharePoint MVP.

No Comments

  • MikeF

    November 19, 2008, 4:23 pm

    With Windows Server 2003, when I run iisapp in the run box from the C prompt, The resulting message says iisapp is not found. When I run iisapp in the cmd window, the message says “the script does not work with WScript.” I have tried running iisapp on three diferent Windows Server 2003 servers with the same results. The example doesn’t show any pathing other than C:

  • Doug Ware

    November 21, 2008, 9:12 am

    Good point. Use cscript.exe.

    Run cscript //h:cscript to make cscript the default script interpreter.

  • Abrar

    April 9, 2009, 9:23 am

    Hi,
    i tried running iisapp from windows command as well as visual studio 2005 command prompts, it gives me an error saying
    “iisapp is not recognized as an internal or external command, operable program or batch file”
    how can i run iisapp now, any other way or path.
    Note: I even tried running “Run cscript //h:cscript “.Thanks

  • Peeyush

    December 8, 2009, 11:35 pm

    %windir%system32inetsrvappcmd.exe list wp

  • Ahmed Ali

    January 5, 2010, 2:34 am

    made the life easier

  • Soumo

    April 11, 2011, 5:22 pm

    Whats the registry change that is required for displaying this?

  • Siva Narayanan

    July 28, 2011, 2:54 pm

    Gr8 Post bro!!

  • Aditya Reddy

    December 2, 2011, 7:00 am

    Thanks for your post.

    i have used %windir%system32inetsrvappcmd.exe list wp to view all the WP.

  • Priyabrata

    August 27, 2012, 10:47 am

    c:windowssystem32inetsrvappcmd list wp
    This will work for sure.

Comments are closed