Skip to content

Remove sc alias which conflicts with sc.exe - #5827

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:remove-sc
Jan 9, 2018
Merged

Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:remove-sc

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jan 8, 2018 •

Copy link
Copy Markdown
Member

PR Summary

SC is a default alias for Set-Content, however on Windows there is a sc.exe command for managing NT Services.
If a user executes sc start service1 in a PowerShell script, what happens is that a file called start is created containing service1 as the content with no error so the user/script may think the service got started.
In addition, there is also a sc command on Linux, although it's not installed by default.
If the customer feedback is that we should not have removed this, it'll be easier to add it back in 6.1.0 than to ever try to remove it after 6.0.0.

Fix is to remove sc alias from InitialSessionState and corresponding test case.
This was discussed with some members of @PowerShell/powershell-committee whom agreed to the removal.

Doc change MicrosoftDocs/PowerShell-Docs#2021

Fix #3980

PR Checklist

Note: Please mark anything not applicable to this PR NA.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows PowerShell only aliases are also included here so this table is a complete source of alias changes. So maybe this entry should be kept and only change the 4th column to be $($FullCLR ) like scb.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll make that change until we completely remove the Windows PowerShell code :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

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

Labels

Breaking-Change breaking change that may affect users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sc start "my service" returns nothing and doesnt start services

3 participants