Revealing Function Source Code

by Apr 5, 2016

Many of the PowerShell commands are made out of functions. Here is how you can peek into the source code of any function:

(Get-Command Test-NetConnection).Definition

Just make sure the command you want to examine does exist, and is a function. Test-NetConnection is available on Windows 8/Server 2012 or better. To see a list of all functions available for spying, use this:

 
PS> Get-Command -CommandType Function
 

Twitter This Tip! ReTweet this Tip!