diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index 5421a6284c3..438b457e9e8 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -943,7 +943,7 @@ public static Collection InvokeOnRunspace(PSCommand command, Runspace [string] $PSEditFunction ) - Register-EngineEvent -SourceIdentifier PSISERemoteSessionOpenFile -Forward + Register-EngineEvent -SourceIdentifier PSISERemoteSessionOpenFile -Forward -SupportEvent if ((Test-Path -Path 'function:\global:PSEdit') -eq $false) { @@ -960,7 +960,7 @@ public static Collection InvokeOnRunspace(PSCommand command, Runspace Remove-Item -Path 'function:\global:PSEdit' -Force } - Unregister-Event -SourceIdentifier PSISERemoteSessionOpenFile -ErrorAction Ignore + Unregister-Event -SourceIdentifier PSISERemoteSessionOpenFile -Force -ErrorAction Ignore "; ///