PowerShell / WindowsCompatibility

Module that allows Windows PowerShell Modules to be used from PSCore6
Other
137 stars 33 forks source link

When import modules from NeverClobberList, each call of the Import-WinModule adds '.WinModule' to the module name. #64

Open sethvs opened 5 years ago

sethvs commented 5 years ago

When we call, for example

Import-WinModule Microsoft.PowerShell.Management

there will be Microsoft.PowerShell.Management.WinModule module

Get-Module Microsoft.PowerShell.Management*

ModuleType Version Name                                      ExportedCommands
---------- ------- ----                                      ----------------
Manifest   6.1.0.0 Microsoft.PowerShell.Management           {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Script     1.0     Microsoft.PowerShell.Management.WinModule {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}

but if we call Import-WinModule Microsoft.PowerShell.Management again, the Microsoft.PowerShell.Management.WinModule will be renamed to Microsoft.PowerShell.Management.WinModule.WinModule

Import-WinModule Microsoft.PowerShell.Management
Get-Module Microsoft.PowerShell.Management*

ModuleType Version Name                                                ExportedCommands
---------- ------- ----                                                ----------------
Manifest   6.1.0.0 Microsoft.PowerShell.Management                     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Script     1.0     Microsoft.PowerShell.Management.WinModule.WinModule {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}

and so on.

So now, each execution of the Import-WinModule adds .WinModule to the name of the imported module.