diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index 5fe16acd369..5421a6284c3 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -960,7 +960,7 @@ public static Collection InvokeOnRunspace(PSCommand command, Runspace Remove-Item -Path 'function:\global:PSEdit' -Force } - Get-EventSubscriber -SourceIdentifier PSISERemoteSessionOpenFile -EA Ignore | Remove-Event + Unregister-Event -SourceIdentifier PSISERemoteSessionOpenFile -ErrorAction Ignore "; ///