how i can see powershell module methods Source code

How I can see source code of functions that are included in third party PowerShell module?

I want to see code for Get-CMSoftwareUpdate (this command is from sccm powershell module)

Depends on how the command was written. You’ve got three main types:

  • PowerShell functions. These are easy, since the function “is” the source code. You can do something like this to open the file up in the ise, if the command is a function: powershell_ise (Get-Command Get-CMSoftwareUpdate).ScriptBlock.File

  • Cmdlets. These are .NET classes, usually written in C#. Unless the source code is open-source, you can’t get its original form, but you can decompile back to a somewhat-readable C# file using free tools such as ILSpy or DotPeek. If it’s a cmdlet, you can find the file that needs to be decompiled like this: (Get-Command Get-CMSoftwareUpdate).ImplementingType.Assembly.Location

  • CIM commands. These are auto-generated PowerShell wrappers around WMI classes; they’re generated from cdxml files in the module directory. I’m not sure if there’s an easy way to open an individual command’s file, but once you know that’s what you’re dealing with, you can browse to the module’s folder and open up the cdxml files to see what it’s doing.

Dave really you are awesome. it helped me.