immense / Remotely

A remote control and remote scripting solution, built with .NET 8, Blazor, and SignalR.
GNU General Public License v3.0
4.5k stars 1.61k forks source link

Terminal - Error executing command after recent upgrade (Docker) #742

Open nexitpl opened 1 year ago

nexitpl commented 1 year ago

Docker

Describe the bug After recent upgrade to Version: 2023.09.11.1010 I can't use terminal to send commands to my endpoints, tried on different endpoints and I always get "Error executing command" and "There was an error executing the command. It has been logged on the client device." Windows 10+ Devices with upgraded agent.

To Reproduce Steps to reproduce the behavior:

  1. Go to Home
  2. Click on Terminal
  3. Choose Endpoint
  4. See error

Remotely Version Server Version: 2023.09.11.1010 Agent Version: 2023.09.11.1010

Logs: [10:10:28 INF] Command executed by X. Shell: PSCore. Command: ipconfig. Devices: 3f54a308-5426-4055-8de3-6b5c57fc49a7 {SourceContext="Remotely.Server.Hubs.CircuitConnection", TransportConnectionId="NBtBYsP3rhxSCSSKM-tmAg", RequestId="0HMTQH7LSJ2MU:00000001", RequestPath="/_blazor", ConnectionId="0HMTQH7LSJ2MU", ThreadId=25}

Screenshots image image

Please Help :)

nexitpl commented 1 year ago

Logs from Agent on endpoint (Windows event log): Application Source: Remotely_Agent Data: 21.09.2023 10:34:14 Category: Remotely.Agent.Services.ScriptExecutor EventId: 0

Error while running command from terminal.

Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Cannot find specific file. File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetExportedTypes() at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile, Dictionary2& cmdlets, Dictionary2& aliases, Dictionary2& providers) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary2& cmdlets, Dictionary2& aliases, Dictionary2& providers, String& helpFile) at System.Management.Automation.Runspaces.InitialSessionState.ImportPSSnapIn(PSSnapInInfo psSnapInInfo, PSSnapInException& warning) at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault() at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host) at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace() at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync) at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke() at Remotely.Agent.Services.PsCoreShell..ctor(IConfigService configService, ILogger1 logger) in C:\repos\Remotely\Agent\Services\PsCoreShell.cs:line 50 at InvokeStub_PsCoreShell..ctor(Object, Object, IntPtr*) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Remotely.Agent.Services.ScriptingShellFactory.GetOrCreatePsCoreShell(String senderConnectionId) in C:\repos\Remotely\Agent\Services\ScriptingShellFactory.cs:line 33 at Remotely.Agent.Services.ScriptExecutor.ExecuteScriptContent(ScriptingShell shell, String terminalSessionId, String command, TimeSpan timeout) in C:\repos\Remotely\Agent\Services\ScriptExecutor.cs:line 169 at Remotely.Agent.Services.ScriptExecutor.RunCommandFromTerminal(ScriptingShell shell, String command, String authToken, String senderUsername, String senderConnectionID, ScriptInputType scriptInputType, TimeSpan timeout, HubConnection hubConnection) in C:\repos\Remotely\Agent\Services\ScriptExecutor.cs:line 77

XML:

0 0 2 0 0 0x80000000000000 33752 Application XXX Category: Remotely.Agent.Services.ScriptExecutor EventId: 0 Error while running command from terminal. Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Cannot find specific file. File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetExportedTypes() at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile, Dictionary`2& cmdlets, Dictionary`2& aliases, Dictionary`2& providers) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary`2& cmdlets, Dictionary`2& aliases, Dictionary`2& providers, String& helpFile) at System.Management.Automation.Runspaces.InitialSessionState.ImportPSSnapIn(PSSnapInInfo psSnapInInfo, PSSnapInException& warning) at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault() at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host) at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace() at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync) at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke() at Remotely.Agent.Services.PsCoreShell..ctor(IConfigService configService, ILogger`1 logger) in C:\repos\Remotely\Agent\Services\PsCoreShell.cs:line 50 at InvokeStub_PsCoreShell..ctor(Object, Object, IntPtr*) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Remotely.Agent.Services.ScriptingShellFactory.GetOrCreatePsCoreShell(String senderConnectionId) in C:\repos\Remotely\Agent\Services\ScriptingShellFactory.cs:line 33 at Remotely.Agent.Services.ScriptExecutor.ExecuteScriptContent(ScriptingShell shell, String terminalSessionId, String command, TimeSpan timeout) in C:\repos\Remotely\Agent\Services\ScriptExecutor.cs:line 169 at Remotely.Agent.Services.ScriptExecutor.RunCommandFromTerminal(ScriptingShell shell, String command, String authToken, String senderUsername, String senderConnectionID, ScriptInputType scriptInputType, TimeSpan timeout, HubConnection hubConnection) in C:\repos\Remotely\Agent\Services\ScriptExecutor.cs:line 77
nexitpl commented 11 months ago

Hello anyone there?