[release/v7.3.0-rc.1] Make experimental feature PSExec stable (#18077)

This commit is contained in:
github-actions[bot]
2022-09-13 10:51:48 -07:00
committed by GitHub
parent e1d5af6dfd
commit 78b555bdb0
7 changed files with 7 additions and 18 deletions
-1
View File
@@ -1,7 +1,6 @@
[
"PSAMSIMethodInvocationLogging",
"PSCommandNotFoundSuggestion",
"PSExec",
"PSLoadAssemblyFromNativeCode",
"PSNativeCommandErrorActionPreference",
"PSRemotingSSHTransportErrorHandling",
-1
View File
@@ -1,7 +1,6 @@
[
"PSAMSIMethodInvocationLogging",
"PSCommandNotFoundSuggestion",
"PSExec",
"PSLoadAssemblyFromNativeCode",
"PSNativeCommandErrorActionPreference",
"PSRemotingSSHTransportErrorHandling",
@@ -24,7 +24,6 @@ namespace System.Management.Automation
internal const string PSNativeCommandErrorActionPreferenceFeatureName = "PSNativeCommandErrorActionPreference";
internal const string PSRemotingSSHTransportErrorHandling = "PSRemotingSSHTransportErrorHandling";
internal const string PSAMSIMethodInvocationLogging = "PSAMSIMethodInvocationLogging";
internal const string PSExecFeatureName = "PSExec";
#endregion
@@ -124,10 +123,7 @@ namespace System.Management.Automation
description: "Removes the SSH remoting transport stdErr stream message handling as terminating errors, and instead just writes error messages to console."),
new ExperimentalFeature(
name: PSAMSIMethodInvocationLogging,
description: "Provides AMSI notification of .NET method invocations."),
new ExperimentalFeature(
name: PSExecFeatureName,
description: "Add 'exec' built-in command on Linux and macOS"),
description: "Provides AMSI notification of .NET method invocations.")
};
EngineExperimentalFeatures = new ReadOnlyCollection<ExperimentalFeature>(engineFeatures);
@@ -4678,10 +4678,7 @@ end {
};
#if UNIX
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSExecFeatureName))
{
builtInAliases.Add(new SessionStateAliasEntry("exec", "Switch-Process"));
}
builtInAliases.Add(new SessionStateAliasEntry("exec", "Switch-Process"));
#endif
return builtInAliases.ToArray();
@@ -5323,10 +5320,7 @@ end {
}
#if UNIX
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSExecFeatureName))
{
cmdlets.Add("Switch-Process", new SessionStateCmdletEntry("Switch-Process", typeof(SwitchProcessCommand), helpFile));
}
cmdlets.Add("Switch-Process", new SessionStateCmdletEntry("Switch-Process", typeof(SwitchProcessCommand), helpFile));
#endif
foreach (var val in cmdlets.Values)
@@ -17,7 +17,6 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Implements a cmdlet that allows use of execv API.
/// </summary>
[Experimental(ExperimentalFeature.PSExecFeatureName, ExperimentAction.Show)]
[Cmdlet(VerbsCommon.Switch, "Process", HelpUri = "https://go.microsoft.com/fwlink/?linkid=2181448")]
public sealed class SwitchProcessCommand : PSCmdlet
{
@@ -4,7 +4,7 @@
Describe 'Switch-Process tests for Unix' -Tags 'CI' {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if (-not [ExperimentalFeature]::IsEnabled('PSExec') -or $IsWindows)
if ($IsWindows)
{
$PSDefaultParameterValues['It:Skip'] = $true
return
@@ -53,7 +53,7 @@ Describe 'Switch-Process tests for Unix' -Tags 'CI' {
Describe 'Switch-Process for Windows' {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if (-not $IsWindows)
if (!$IsWindows)
{
$PSDefaultParameterValues['It:Skip'] = $true
return
@@ -58,6 +58,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Alias", "epsn", "Export-PSSession", $($FullCLR ), "", "", ""
"Alias", "erase", "Remove-Item", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", ""
"Alias", "etsn", "Enter-PSSession", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", ""
"Alias", "exec", "Switch-Process", $( $CoreUnix), "", "", ""
"Alias", "exsn", "Exit-PSSession", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", ""
"Alias", "fc", "Format-Custom", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "", ""
"Alias", "fhx", "Format-Hex", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", ""
@@ -482,6 +483,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Stop-Transcript", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None"
"Cmdlet", "Suspend-Job", "", $($FullCLR ), "", "", ""
"Cmdlet", "Suspend-Service", "", $($FullCLR -or $CoreWindows ), "", "", "Medium"
"Cmdlet", "Switch-Process", "", $( $CoreUnix), "", "", "None"
"Cmdlet", "Tee-Object", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "Medium"
"Cmdlet", "Test-Connection", "", $( $CoreWindows -or $CoreUnix), "", "", "None"
"Cmdlet", "Test-ComputerSecureChannel", "", $($FullCLR ), "", "", ""