Monday, April 20, 2015

#55 : Process Handling with Powershell

You can get list of running Processes with command like Get-Process. 

Below command be used to get Names of all processes running - 


CODE: 
 

Stop a Process if the process is running :

I am not sure why somebody would need this. But anyways, just for learning - you can use below -
Below statement would stop each occurence of Notepad running.
CODE:
 

Find the Process which is using maximum CPU :

Yeah, this might be a good example.
CODE:
 

Find the Process which is using minumum CPU :

Below code is just one word different from above. Select-Object -First 1.
CODE:
Find the Process with more than one Occurences : 
CODE:

1 comment:

#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...