by GuyThomas at 2013-04-04 13:11:58
I am familiar with Get-Help Noun-Verb -full.by DonJ at 2013-04-04 22:45:28
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?
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.by nohandle at 2013-04-05 01:25:43
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.
Hi,by GuyThomas at 2013-04-05 01:47:42
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.
This is the article that showed me how to do it when I was trying to do the same thing: http://myne-us.blogspot.cz/2012/08/reve … dlets.html
Two brilliant replies. Exceeded what I had hoped for (especially that link). Thank you Don and Jakub.