-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Rename powershell.exe to pwsh.exe #5101
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
Changes from all commits
d948bf6
d992c7b
b4daecd
4227515
26f92f4
a5e7240
b41e048
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ public sealed class ScheduledJobDefinition : ISerializable, IDisposable | |
| private bool _isDisposed; | ||
|
|
||
| // Task Action strings. | ||
| private const string TaskExecutionPath = @"powershell.exe"; | ||
| private const string TaskExecutionPath = @"pwsh.exe"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code assumes a discoverable pwsh.exe native command. Does this fix include adding pwsh.exe to the system path environment variable? If so what version? I wonder if we should allow the user to select a powershell.exe or pwsh.exe path to use for scheduled jobs (maybe in a separate issue/pr).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should use Utils.DefaultPowerShellAppBase here as we do with PowerShellProcessInstance.cs to ensure the scheduled job is using the correct path.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a separate PR coming for the msi installer to append to %PATH% which would also solve the Win+R->pwsh usage If PSCore6 is uninstalled, the full path won't help either.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I'll do the %PATH% msi change as part of this PR as it's more useful that pwsh.exe differs form powershell.exe and I can put it at the end of the path rather than taking over the front |
||
| private const string TaskArguments = @"-NoLogo -NonInteractive -WindowStyle Hidden -Command ""Import-Module PSScheduledJob; $jobDef = [Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition]::LoadFromStore('{0}', '{1}'); $jobDef.Run()"""; | ||
| private static object LockObject = new object(); | ||
| private static int CurrentId = 0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # escape=` | ||
| FROM microsoft/windowsservercore | ||
|
|
||
| SHELL ["powershell.exe","-command"] | ||
| SHELL ["pwsh.exe","-command"] | ||
|
||
|
|
||
| # the source msi should change on a daily basis | ||
| # the destination should not change | ||
|
|
@@ -18,7 +18,7 @@ RUN new-LocalUser -Name testuser -password (ConvertTo-SecureString 11aa!!AA -asp | |
| set-item WSMan:/localhost/client/AllowUnencrypted $true; ` | ||
| Start-Process -FilePath msiexec.exe -ArgumentList '-qn', ` | ||
| '-i c:\PSCore.msi','-log c:\PSCore-install.log','-norestart' -wait ; ` | ||
| $psexec = get-item -path ${ENV:ProgramFiles}/powershell/*/powershell.exe; ` | ||
| $psexec = get-item -path ${ENV:ProgramFiles}/powershell/*/pwsh.exe; ` | ||
| $corehome = $psexec.directory.fullname; ` | ||
| & $psexec Install-PowerShellRemoting.ps1; ` | ||
| remove-item -force c:\PSCore.msi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full path is removed here. Is this because we are putting it to %PATH%?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the msi installer to add it to %PATH%, I wanted to remove it since it references a specific version path. I'll do the msi update separate from this PR.