diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
index 6908320db5..795921a0c5 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
@@ -690,7 +690,6 @@ namespace Microsoft.PowerShell
if (!string.IsNullOrEmpty(bannerText))
{
hostUI.WriteLine(bannerText);
- hostUI.WriteLine();
}
if (UpdatesNotification.CanNotifyUpdates)
diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs
index e9bc2d343b..455efe84d1 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs
+++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs
@@ -126,6 +126,7 @@ namespace Microsoft.PowerShell
string notificationMsg = string.Format(CultureInfo.CurrentCulture, notificationMsgTemplate, releaseTag, notificationColor, resetColor, line2Padding, line3Padding);
+ hostUI.WriteLine();
hostUI.WriteLine(notificationMsg);
}
}
diff --git a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx
index 7b13837b29..481a4216cf 100644
--- a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx
+++ b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx
@@ -118,11 +118,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- PowerShell {0}
-Copyright (c) Microsoft Corporation.
-
-https://aka.ms/powershell
-Type 'help' to get help.
+ PowerShell {0}
Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.
@@ -383,7 +379,7 @@ All parameters are case-insensitive.
-NoLogo | -nol
- Hides the copyright banner at startup of interactive sessions.
+ Hides the banner text at startup of interactive sessions.
-NonInteractive | -noni
diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1
index 06f8f0a819..1798a71939 100644
--- a/test/powershell/Host/ConsoleHost.Tests.ps1
+++ b/test/powershell/Host/ConsoleHost.Tests.ps1
@@ -857,6 +857,64 @@ $powershell -c '[System.Management.Automation.Platform]::SelectProductNameForDir
$LASTEXITCODE | Should -Be $ExitCodeBadCommandLineParameter
}
}
+
+ Context "Startup banner text tests" -Tag Slow {
+ BeforeAll {
+ $outputPath = "Temp:\StartupBannerTest-Output-${Pid}.txt"
+ $inputPath = "Temp:\StartupBannerTest-Input.txt"
+ "exit" > $inputPath
+
+ # Not testing update notification banner text here
+ $oldPowerShellUpdateCheck = $env:POWERSHELL_UPDATECHECK
+ $env:POWERSHELL_UPDATECHECK = "Off"
+
+ # Set TERM to "dumb" to avoid DECCKM codes in the output
+ $oldTERM = $env:TERM
+ $env:TERM = "dumb"
+
+ $escPwd = [regex]::Escape($pwd)
+ $expectedPromptPattern = "^PS ${escPwd}> exit`$"
+
+ $spArgs = @{
+ FilePath = $powershell
+ ArgumentList = @("-NoProfile")
+ RedirectStandardInput = $inputPath
+ RedirectStandardOutput = $outputPath
+ WorkingDirectory = $pwd
+ PassThru = $true
+ NoNewWindow = $true
+ UseNewEnvironment = $false
+ }
+ }
+ AfterAll {
+ $env:TERM = $oldTERM
+ $env:POWERSHELL_UPDATECHECK = $oldPowerShellUpdateCheck
+
+ Remove-Item $inputPath -Force -ErrorAction Ignore
+ Remove-Item $outputPath -Force -ErrorAction Ignore
+ }
+ BeforeEach {
+ Remove-Item $outputPath -Force -ErrorAction Ignore
+ }
+ It "Displays expected startup banner text by default" {
+ $process = Start-Process @spArgs
+ Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 250 | Should -BeTrue
+
+ $out = @(Get-Content $outputPath)
+ $out.Count | Should -Be 2
+ $out[0] | Should -BeExactly "PowerShell $($PSVersionTable.GitCommitId)"
+ $out[1] | Should -MatchExactly $expectedPromptPattern
+ }
+ It "Displays only the prompt with -NoLogo" {
+ $spArgs["ArgumentList"] += "-NoLogo"
+ $process = Start-Process @spArgs
+ Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 250 | Should -BeTrue
+
+ $out = @(Get-Content $outputPath)
+ $out.Count | Should -Be 1
+ $out[0] | Should -MatchExactly $expectedPromptPattern
+ }
+ }
}
Describe "WindowStyle argument" -Tag Feature {