Skip to content

Instantly share code, notes, and snippets.

@NicholasLeader
Created May 16, 2016 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicholasLeader/a35bcdea1cf1df1c8bb6a37976edfe7c to your computer and use it in GitHub Desktop.
Save NicholasLeader/a35bcdea1cf1df1c8bb6a37976edfe7c to your computer and use it in GitHub Desktop.
PowerShell .NET example using inline .NET
<#
Nicholas Leader
05/16/2016
Quick example .NET
This is one of the things that makes PowerShell extensible - you can do inline .NET
Reference: https://blogs.technet.microsoft.com/heyscriptingguy/2010/10/26/learn-how-to-use-net-framework-commands-inside-windows-powershell/
#>
# using the System.Diagnostics.Process .NET class to grab the local processes
[diagnostics.process]::GetProcesses() |
# piping output to the 'sort-object' PowerShell cmdlet, then sorting on 'processName' descending
Sort-Object -Property ProcessName -Descending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment