But what I am looking for is the details of how a particular Function (Cmdlet) is put together. For example what is in the 'Process' section of a built-in PowerShell Cmdlet?
Put another way, if we create a function we publish the all its code. Is there anyway of seeing the same level of detail that Microsoft put into their built-in cmdlets / functions?
by DonJ at 2013-04-04 22:45:28
Native cmdlets aren't written in script – they're written in (usually) C# and "compiled" into MSIL and native code. You can't readily access that source code. You could in theory decompile it into C# if the source wasn't heavily obfuscated. But you'd be looking at C#, not at PowerShell script. The workings of a cmdlet are a bit different than a function – it uses different techniques to produce output, for example, and parameters are defined and used somewhat differently.
Functions are written in script, and you can easily view their source code. They load into the FUNCTION: drive – just run Get-Content against them. This applies to any function, including ones authored by Microsoft.
by nohandle at 2013-04-05 01:25:43
Hi, yes there is at least for the native cmdlets. The process includes seeking the correct assembly and using tools like .NET Reflector (paid) or dotPeek (free). But as Don said the cmdlets are not written in PowerShell so if you are not familiar with C# you will be bit lost at first.