Oct 24 2008

PowerShell

Category: zvolkov @ 21:05

In case I'm not the only one having missed the emergence of Microsoft's incredible PowerShell shell.

Examples:

Stop all processes that begin with the letter "p":

PS C:\> get-process p* | stop-process -whatif

PS C:\> ps p* | kill -whatif

Find the processes that use more than 1000 MB of memory and kill them:

PS C:\> get-process | where-object { $_.WS -gt 1000MB } | stop-process -whatif

PS C:\> ps | ? { $_.WS -gt 1000MB } | kill -whatif

Calculate the number of bytes in the files in a directory:

PS C:\> get-childitem | measure-object -property length -sum

PS C:\> ls | measure-object -p length -s 

 

There also are numerous add-ins for Exchange, SQL Server, IIS etc. to enable automation of advanced administration / management / deployment scenarios. Check it out! Time to dump your .CMDs!

Tags:

Comments

Comments are closed