From 9ea60587fc81b83ac88d87ad982a75df51e3fd2a Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Mon, 25 Mar 2019 09:39:15 -0700 Subject: [PATCH] Add psremoting enable/disable cmdlet warning messages (#9203) Adds warning messages to the Enable-PSRemoting and Disable-PSRemoting cmdlets that informs the user that the cmdlets only affect PSCore6 remoting endpoint configurations and not Windows PowerShell configurations. PR Context As documented, Enable-PSRemoting and Disable-PSRemoting affects all PowerShell remoting on a Windows system, and Windows users will likely expect the cmdlets to continue working this way in PSCore6. However, these cmdlets currently affect only PSCore6 remoting endpoints when run in PSCore6 and have no effect on Windows remoting endpoints. --- .../remoting/commands/CustomShellCommands.cs | 3 + .../resources/RemotingErrorIdStrings.resx | 71 ++++++++++--------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index fcfeb43844..6d59d474f3 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -5223,6 +5223,8 @@ Enable-PSRemoting -force $args[0] -queryForRegisterDefault $args[1] -captionForR /// protected override void EndProcessing() { + WriteWarning(RemotingErrorIdStrings.PSCoreRemotingEnableWarning); + // gather -WhatIf, -Confirm parameter data and pass it to the script block bool whatIf = false; // confirm is always true to start with @@ -5426,6 +5428,7 @@ Disable-PSRemoting -force:$args[0] -queryForSet $args[1] -captionForSet $args[2] /// protected override void EndProcessing() { + WriteWarning(RemotingErrorIdStrings.PSCoreRemotingDisableWarning); WriteWarning(StringUtil.Format(RemotingErrorIdStrings.DcsWarningMessage)); WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.EcsScriptMessageV, disablePSRemotingFormat)); diff --git a/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx b/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx index e2a231edf5..74c120bf35 100644 --- a/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx +++ b/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx @@ -1,17 +1,17 @@ - @@ -655,7 +655,7 @@ Session configuration "{0}" is not a PowerShell-based shell. - + Session configuration "{0}" is a PowerShell Core-based shell. Please use PowerShell Core to modify it. @@ -1114,8 +1114,8 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro {0} authentication requires an explicit user name and password. Specify the user name and password by using the -Credential parameter and try the command again. - - Basic authentication is not supported over HTTP on Unix. + + Basic authentication is not supported over HTTP on Unix. Cannot find a scheduled job with name {0}. @@ -1662,10 +1662,10 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro PowerShell Core does not support WOW64. The binary must match the architecture of the processor. - Unable to install plugin {0} to directory {1}. + Unable to install plugin {0} to directory {1}. - The WinRM plugin DLL {0} is missing for PowerShell. Please run Enable-PSRemoting and then retry this command. + The WinRM plugin DLL {0} is missing for PowerShell. Please run Enable-PSRemoting and then retry this command. This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system. @@ -1686,4 +1686,11 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro HTTPS on Unix does not currently support CA or CN checks. Use the PSSessionOption -SkipCACheck and -SkipCNCheck if you are certain you trust the server you are connecting to and the network in between. + + PowerShell remoting has been disabled only for PowerShell Core configurations and does not affect Windows PowerShell remoting configurations. Run this cmdlet in Windows PowerShell to affect all PowerShell remoting configurations. + + + + PowerShell remoting has been enabled only for PowerShell Core configurations and does not affect Windows PowerShell remoting configurations. Run this cmdlet in Windows PowerShell to affect all PowerShell remoting configurations. +