Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,25 +246,6 @@ protected override void ProcessRecord()
return;
}

// Check if current host is remote host. Enter-PSSession on remote host is not
// currently supported.
if (!IsParameterSetForVM() &&
!IsParameterSetForContainer() &&
!IsParameterSetForVMContainerSession() &&
this.Context != null &&
this.Context.EngineHostInterface != null &&
this.Context.EngineHostInterface.ExternalHost != null &&
this.Context.EngineHostInterface.ExternalHost is System.Management.Automation.Remoting.ServerRemoteHost)
{
WriteError(
new ErrorRecord(
new ArgumentException(GetMessage(RemotingErrorIdStrings.RemoteHostDoesNotSupportPushRunspace)),
PSRemotingErrorId.RemoteHostDoesNotSupportPushRunspace.ToString(),
ErrorCategory.InvalidArgument,
null));
return;
}

// for the console host and Graphical PowerShell host
// we want to skip pushing into the the runspace if
// the host is in a nested prompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ internal enum PSRemotingErrorId : uint
RemoteRunspaceHasMultipleMatchesForSpecifiedName = 955,
RemoteRunspaceDoesNotSupportPushRunspace = 956,
HostInNestedPrompt = 957,
RemoteHostDoesNotSupportPushRunspace = 958,
InvalidVMId = 959,
InvalidVMNameNoVM = 960,
InvalidVMNameMultipleVM = 961,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,6 @@ public virtual bool IsRunspacePushed
/// </summary>
internal HostInfo HostInfo { get; }

/// <summary>
/// Allows a push runspace on this remote server host instance, regardless of
/// transport being used.
/// </summary>
internal virtual bool AllowPushRunspace
{
get { return (_serverDriverRemoteHost != null) ? _serverDriverRemoteHost.AllowPushRunspace : false; }

set { if (_serverDriverRemoteHost != null) { _serverDriverRemoteHost.AllowPushRunspace = value; } }
}

#endregion

#region Method Overrides
Expand Down Expand Up @@ -328,18 +317,6 @@ public override bool IsRunspacePushed
/// <param name="runspace">RemoteRunspace.</param>
public override void PushRunspace(Runspace runspace)
{
// Double session hop is currently allowed only for WSMan (non-OutOfProc) sessions, where
// the second session is either through a named pipe or hyperV socket connection.
if (!AllowPushRunspace &&
((_transportManager is OutOfProcessServerSessionTransportManager) ||
!(runspace.ConnectionInfo is NamedPipeConnectionInfo ||
runspace.ConnectionInfo is VMConnectionInfo ||
runspace.ConnectionInfo is ContainerConnectionInfo))
)
{
throw new PSNotSupportedException();
}

if (_debugger == null)
{
throw new PSInvalidOperationException(RemotingErrorIdStrings.ServerDriverRemoteHostNoDebuggerToPush);
Expand Down Expand Up @@ -417,16 +394,6 @@ internal Runspace PushedRunspace
get { return _pushedRunspace; }
}

/// <summary>
/// Allows a push runspace on this remote server host instance, regardless of
/// transport being used.
/// </summary>
internal override bool AllowPushRunspace
{
get;
set;
}

/// <summary>
/// When true will propagate pop call to client after popping runspace from this
/// host. Used for OutOfProc remote sessions in a restricted (pushed) remote runspace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,7 @@ private void HandleRunspaceCreatedForTypeTable(object sender, RunspaceCreatedEve
{
// Let exceptions propagate.
RemoteRunspace remoteRunspace = HostUtilities.CreateConfiguredRunspace(_configurationName, _remoteHost);

_remoteHost.AllowPushRunspace = true;
_remoteHost.PropagatePop = true;

_remoteHost.PushRunspace(remoteRunspace);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,6 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro
<data name="EnableNetworkAccessWarning" xml:space="preserve">
<value>PSSession {0} was created using the EnableNetworkAccess parameter and can only be reconnected from the local computer.</value>
</data>
<data name="RemoteHostDoesNotSupportPushRunspace" xml:space="preserve">
<value>You are currently in a PowerShell PSSession and cannot use the Enter-PSSession cmdlet to enter another PSSession.</value>
</data>
<data name="CannotStartJobInconsistentLanguageMode" xml:space="preserve">
<value>Cannot start job. The language mode for this session is incompatible with the system-wide language mode.</value>
</data>
Expand Down