Q:

Can we see the source code for PowerShell cmdlets?

I'm learning some PowerShell. Is it possible to see the source code for a built-in cmdlet like Get-ChildItem?

A:

The source for Powershell is now available on Github.
The source for Get-ChildItem can be found here.

A:

Actually, your best bet is to go check out PowerShell Community Extensions. This open source software community project is "aimed at providing a widely useful set of additional cmdlets...". The developers on the project are PowerShell MVPs and know their stuff.
As far as using reflection on the existing PowerShell cmdlets, PowerShell MVP Oisin Grehan made a handy function titled "Reflect-Cmdlet". I won't steal his code and place it here, but basically what you do is:
Get-Command Get-ChildItem | Reflect-Cmdlet

And then .NET Reflector pops up with the right assembly opened up and expanded and everything. It's really pretty cool. Here's a screenshot:
Alt text http://halr9000.com/images/screenshots/reflector.png

A:

I think if you were just starting PowerShell, this is what you'd be looking for:
$metadata = New-Object system.management.automation.commandmetadata (Get-Command Get-Process)
[System.management.automation.proxycommand]::Create($MetaData) | out-file C:\powershell\get-process.ps1

This will create a script which shows how Get-Process runs. Put in any cmdlet you want to replace Get-Process. If you want to google more about it, this is how you would create a proxy function.

