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.
This commit is contained in:
Paul Higinbotham 2019-03-25 09:39:15 -07:00 committed by Travis Plunk
parent cd7d7797e4
commit 9ea60587fc
2 changed files with 42 additions and 32 deletions

View file

@ -5223,6 +5223,8 @@ Enable-PSRemoting -force $args[0] -queryForRegisterDefault $args[1] -captionForR
/// </summary>
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]
/// </summary>
protected override void EndProcessing()
{
WriteWarning(RemotingErrorIdStrings.PSCoreRemotingDisableWarning);
WriteWarning(StringUtil.Format(RemotingErrorIdStrings.DcsWarningMessage));
WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.EcsScriptMessageV, disablePSRemotingFormat));

View file

@ -655,7 +655,7 @@
</data>
<data name="CSCmdsShellNotPowerShellBased" xml:space="preserve">
<value>Session configuration "{0}" is not a PowerShell-based shell.</value>
</data>
</data>
<data name="CSCmdsPowerShellCoreShellNotModifiable" xml:space="preserve">
<value>Session configuration "{0}" is a PowerShell Core-based shell. Please use PowerShell Core to modify it.</value>
</data>
@ -1114,8 +1114,8 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro
<data name="AuthenticationMechanismRequiresCredential" xml:space="preserve">
<value>{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.</value>
</data>
<data name="BasicAuthOverHttpNotSupported">
<value>Basic authentication is not supported over HTTP on Unix.</value>
<data name="BasicAuthOverHttpNotSupported" xml:space="preserve">
<value>Basic authentication is not supported over HTTP on Unix.</value>
</data>
<data name="StartJobDefinitionNotFound1" xml:space="preserve">
<value>Cannot find a scheduled job with name {0}.</value>
@ -1662,10 +1662,10 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro
<value>PowerShell Core does not support WOW64. The binary must match the architecture of the processor.</value>
</data>
<data name="UnableToInstallPlugin" xml:space="preserve">
<value>Unable to install plugin {0} to directory {1}.</value>
<value>Unable to install plugin {0} to directory {1}.</value>
</data>
<data name="PluginDllMissing" xml:space="preserve">
<value>The WinRM plugin DLL {0} is missing for PowerShell. Please run Enable-PSRemoting and then retry this command.</value>
<value>The WinRM plugin DLL {0} is missing for PowerShell. Please run Enable-PSRemoting and then retry this command.</value>
</data>
<data name="WSManClientDllNotAvailable" xml:space="preserve">
<value>This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.</value>
@ -1686,4 +1686,11 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro
<data name="UnixOnlyHttpsWithoutSkipCACheckNotSupported" xml:space="preserve">
<value>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.</value>
</data>
<data name="PSCoreRemotingDisableWarning" xml:space="preserve">
<value>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.
</value>
</data>
<data name="PSCoreRemotingEnableWarning" xml:space="preserve">
<value>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.</value>
</data>
</root>