I copied two functions from a cmdlet script distributed with Microsoft PowerShell v5, inside my script that should run on PowerShell v3. Also I slightly modified it. Do I invalid a license or can I get in trouble if I publish this code on let's say Github? I can't find anything relevant to the licence attached to cmdlet scripts distributed with WMF (Windows Management Framework).
You would need to determine which PowerShell Module the Cmdlet in question belongs to. You can use the "Get-Command" Cmdlet to retrieve this information (Obviously, you'll want to Replace with the Name of the actual Cmdlet).
Get-Command <CmdletName> | Select-Object Name, Module, ModuleName
Once you have the Module Info, you'll want to Locate the Module Manifest File, which can be in one of several locations (depending on your PS Configuration).
Here are Three potential Locations, off the top of my head. The Manifest File should contain a .psd Extension.
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\<ModuleName> C:\Users\<UserName>\Documents\WindowsPowerShell\Modules\<ModuleName> C:\Program Files\WindowsPowerShell\Modules\<ModuleName>
Once Located, Open the Manifest File and Locate the "Copyright" Line, as it should list the Name of the Module Author, whom you will want to reach out to regarding your specific Copyright Question(s).
If this is a Microsoft Cmdlet/Module, you may be happy to read that PowerShell is currently Open Source.
Regardless, you will want to review the Copyright Information, which can you can find, via the Link below, as there are particular requirements regarding the re-use of MS Software, Scripts, Modules, Cmdlets, etc.
In particular, you will want to Expand and Read the "Redistributing software" Section.
For the most part, as long as your PS Script, itself, is also Open Source, you shouldn't have any problems as long as you comply with the "Requirements for allowed uses" Guidelines.
If you would like additional Information, regarding a particular PS Cmdlet, please respond with the Name of the Cmdlet that you are referring to in your Original Post, as I will be happy to dig up the necessary Information, on your behalf.
I hope this is helpful. Feel free to respond with questions. I'll do my best to answer them, as soon as possible.