Can I use PowerShell 1.0 to list processes along with their PIDs and Command Lines? -


Edit by OP: My question was assumed that PowerShell is the best tool for this job Was there. There is a simple way of achieving my goal: A friend told me just about it: It displays absolutely essential information without the need of PowerShell.


I have dozens of ASP.NET websites running locally and when I want to debug a particular website name, for example, foo Site.com I go through the following steps:

  1. Run Process Explorer (from SysInternals) and it seems that w3wp.exe was started with foo.site.com on its command line.

  2. Note the Process ID (PID) of that w3wp.exe process.

  3. Visual Studio is connected to that process ID

Is there a way to write a PowerShell script that is my Will each of the w3wp.exe process running on the computer print the PID and command line logic?

When I run the matching process w3wp, I get:

  & gt; Received Process w3wp Handle NPM (K) PM (K) WS (K) VM (M) CPU (S) ID Process Name ------- ----------- ----- ----- ------- ----------- 688 28 44060 64576 226 2,75 196 w3wp 750 26 48328 68936 225 3,38 w3wp 989 36 54596 83844 246 4,92 1660 w3wp 921 33 1640 54344 80576 270 4.24 5624 w3wp 773 27 48808 72448 244 2.75 5992 w3wp  

There is no command line information: (

Thank you!

Edit: I'm looking for command line arguments passed to W3wp.

< P> gwmi win32_process -filter "name = 'w3wp.exe'" | Select the name, ProcessId, commandLine

This should do the trick. I find it weird that PowerShell does not provide command line information by default.Note: I have tested it only in powers 2.0, but As it uses WMI, it should work in 1.0.

EDIT: The last version used by Tim Stewart (to see the problem, see the comment):
gwmi win32_process -filter "name = 'powershell.exe'" | Format-Table-Autosize Name, ProCid, Commandline


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -