Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carbon breaks the Get-WindowsFeature command when present on the system #52

Closed
brantb opened this issue Oct 18, 2018 · 1 comment
Closed
Assignees
Milestone

Comments

@brantb
Copy link

brantb commented Oct 18, 2018

On Server OSes, If Carbon is present on the module load path and a script uses the Get-WindowsFeature cmdlet, it throws a CommandNotFoundException unless the ServerManager module is explicitly imported first.

To reproduce:

PS> Get-Command Get-WindowsFeature

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-WindowsFeature                                 2.0.0.0    ServerManager

PS> Install-Module Carbon -AllowClobber
PS> Get-WindowsFeature

Get-WindowsFeature : The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Get-WindowsFeature
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-WindowsFeature:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I realize Carbon probably implemented Get-WindowsFeature before ServerManager did, but sometimes it isn't possible to control what modules are loaded ahead of time, such as in OneGet/MicrosoftDockerProvider#26. The fact that a CommandNotFoundException occurs is also very confusing and hides the underlying issue.

Environment info:

  • Carbon: 2.6.0
  • OS: Windows Server 1607
  • $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.14393.2515
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2515
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@brantb brantb changed the title Carbon breaks the Get-WindowsFeature module when present on the system Carbon breaks the Get-WindowsFeature command when present on the system Oct 18, 2018
@splatteredbits splatteredbits added this to the 2.7.0 milestone Nov 27, 2018
@splatteredbits splatteredbits self-assigned this Nov 27, 2018
@splatteredbits
Copy link
Member

I'm currently working on this. See commits here: https://github.com/pshdo/Carbon/tree/feature/stop-carbon-name-collisions

The plan is to add a C prefix to every Carbon command. To avoid breaking backwards compatibility, we're also adding a bunch of aliases from the old command names to the new command names. Since Carbon's manifest only lists the functions it exports and not any aliases, PowerShell's auto-module loading feature will no longer think Carbon has a Get-WindowsFeature command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants