WindowsCompatibility
WindowsCompatibility copied to clipboard
When import modules from NeverClobberList, each call of the Import-WinModule adds '.WinModule' to the module name.
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.