Remote host method get_BufferSize is not implemented..

Posted on
powershell .net

Do you see ‘Remote host method get_BufferSize is not implemented..’ or something like this below?

[145914][Step 11] Executing Invoke-Command -ComputerName server-1 -ScriptBlock { iisreset }
[145915][Step 11] Program 'iisreset.exe' failed to run Remote host method get_BufferSize is not implemented..
[145916][Step 11] An error occurred when executing task 'RestartServers'.
[145916][Step 11] Error One or more errors occurred.
[145916][Step 11]   Failed to Execute Powershell Script System.Management.Automation.RemoteException Program 'iisreset.exe' failed to run Remote host method get_BufferSize is not implemented..
[145916][Step 11] Process exited with code 1
[145916][Step 11] Process exited with code 1 (Step PowerShell)

How to fix it?

This issue can happen environment does not support console outputting. To fix this issue run powershell with

OutputToAppConsole = false

See example how to run powershell command using Cake Build to avoid error Remote host method get_BufferSize is not implemented..

StartPowershellScript("Invoke-Command", new PowershellSettings {
    OutputToAppConsole = false,
    Arguments = ProcessArgumentBuilder.FromString($"-ComputerName {machine}" + " -ScriptBlock { iisreset }")
});