Thursday, January 22, 2015

#41 : View Process Commandline with Powershell

Process can be viewed easily in Powershell with Get-Process command. This command is useful, but it has some shortcomings -
1. It does not show the command-line and arguments passed to the command.
2. It does not show the Path of command.

Due to these shortcomings, I started looking for some option by which we can get the list of processes with complete details. The search completed and it came with WMI and Powershell combination. Below is the single line which can solve this problem.

Get-WmiObject Win32_process |   select  ParentProcessId, ProcessId, Name, Commandline  | ft

Based on the above, you can write a script which could kill processes by specific application, but be careful, killing a operating system process might shutdown the machine.

Happy scripting!!

1 comment:

  1. Your website is very beautiful or Articles. I love it thank you for sharing for everyone. Curso de Python intermediate and advanced

    ReplyDelete

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...