Hi,
we’re testing Otter for managing multiple Windows Server and Linux machines in an agentless way (WinRM for Windows, SSH for Linux).
The Windows servers have WinRM correctly configured, and we can run PowerShell commands successfully from our admin workstation using:
Invoke-Command -ComputerName WIN001 { Write-Output "Test from $env:COMPUTERNAME" }
However, when we try to run the same simple script from Otter using the "PowerShell (no agent)" option, the job always fails with a runspace error:
Unhandled exception: System.Management.Automation.Runspaces.InvalidRunspaceStateException: Cannot perform operation because the runspace is not in the 'Opened' state. Current state of runspace is 'Closed'.
at System.Management.Automation.PowerShell.CoreInvokeAsync[TInput,TOutput](PSDataCollection1 input, PSDataCollection
1 output, PSInvocationSettings settings, AsyncCallback callback, Object state, PSDataCollection1 asyncResultOutput) at System.Management.Automation.PowerShell.BeginInvoke[T](PSDataCollection
1 input, PSInvocationSettings settings, AsyncCallback callback, Object state)
at Inedo.Agents.PowerShell.PowerShellExtensions.InvokeInternalAsync(PowerShell ps)
at Inedo.Agents.PowerShell.PowerShellAgentClient.ExecuteCmdLetAsync(String cmdLet, KeyValuePair2[] args) at Inedo.Agents.PowerShell.PowerShellFileOperationsExecuter.FileExistsAsync(String path) at Inedo.Agents.Hosting.ScriptableRemoteAgentHost.EnsureAgentBinariesAsync(Func
1 getPackage, IEnumerable1 extensions, Func
2 openExtension, Func1 updateStarted) at Inedo.Otter.Service.Agents.PowerShellAgentConnection.GetRemoteHostAsync() at Inedo.Otter.Service.Agents.PowerShellAgentConnection.TryGetServiceInternalAsync(Type serviceType) at Inedo.Otter.Extensions.Agents.AgentConnection.TryGetServiceAsync(Type serviceType) at Inedo.Otter.Extensions.Agents.ConnectingAgent.GetAgentServiceInternalAsync(Type service) at Inedo.Otter.Extensions.Agents.ConnectingAgent.GetAgentServiceInternal(Type service) at Inedo.Extensibility.Agents.Agent.GetService[TService]() at Inedo.Extensions.Scripting.PowerShell.PSUtil2.ExecuteScript2Async(IPSScriptingOperation operation, IOperationExecutionContext context, Boolean collectOutput, EventHandler
1 progressUpdateHandler, String successExitCode, PsExecutionMode executionMode, Boolean preferWindowsPowerShell) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp_E578465\Src\Scripting\InedoExtension\PowerShell\PSUtil2.cs:line 131
at Inedo.Extensions.Scripting.Operations.PowerShell.PSCall2Operation.ExecuteAsync(IOperationExecutionContext context) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp_E578465\Src\Scripting\InedoExtension\Operations\PowerShell\PSCall2Operation.cs:line 87
at Inedo.Otter.Service.PlanExecuter.OtterScriptExecuter.PerformExecution(ActionStatement actionStatement, ILogSink logger, Operation operation, OperationExecutionContext operationContext, OperationInputState hash)
at Inedo.Otter.Service.PlanExecuter.OtterScriptExecuter.Inedo.ExecutionEngine.Executer.IExecutionHostEnvironment.ExecuteActionAsync(ActionStatement actionStatement, IExecuterContext context)
Additional details:
Server status is “Ready,” and OS info is correctly detected.
Execution Policy on the target servers is Unrestricted.
We’re using a domain account with local admin rights via GPO.
We run the same test against multiple Windows servers, all with the same issue.
In the Windows Event Log, we see entries about creating a ScriptBlock, but no clear error messages.
Linux shell scripts via SSH run just fine.
Questions:
Is there any specific PowerShell version or setting required for Otter's WinRM integration?
Where can we find more detailed logs on the target server or on the Otter server to debug this issue?
Thanks for any help you can provide.