Playbook to execute a powershell script not working

  • 6 January 2021
  • 4 replies


HI All,

I am trying to execute a remote PS script in a windows server using the playbooks. Have kept the script very simple for now to test the execution, but I get the error “ Failed to execute action with error: Internal Error, Connection reset by remote peer.” every time its executed.


  • Execution Start Time: 01/06/21, 5:21:32 PM
  • Execution End Time: 01/06/21, 5:21:32 PM
  • Result: FAILED


Username: serveradmin
Path to Script: E:\NutanixPS\Nutanix-CVM-Post-reboot-checks.ps1
Password: ********
IP Address/Hostname:
Has anyone faced a similar issue and what is the fix?

4 replies

Userlevel 5
Badge +4

Hey, @AbhilashT Happy new year mate.


So have you tried it with HTTPS as false? 


So running this playbook requires VMs IP address, Uname, pass, and the path to the script and HTTPS setting, which is all there as you mentioned.

Looks like a connectivity issue to me. It seems the script cannot be executed on the VM due to some connectivity issues. 

Generally, such errors indicate that the remote machine abruptly closed the Transition Control Protocol (TCP) stream. In most instances, a quick reboot of a remote server might solve a temporary outage or connectivity issue.

Can you check the below:

  • The connection to the VM is being blocked due to the Host-Based Access Control Lists.
  • Any firewall rules (Fail2ban, DenyHosts, etc.) not lettings the script to run on the VM.
  • Changes to the SSH daemon configuration file on VM.


Userlevel 6
Badge +16

Take a look at this:


Thanks Primzy & Anish.


I did some research and found that if I us an external AD account the script is getting executed, all this time I was using a local account that is part of administrators group on the server. But need to find a way to use the local account itself as the AD account password will reset very 24hrs. I think it has something to do with the below show ‘allow remote connections to this computer’ setting. Have tried unchecking the “allow connections only from the computers running Remote Desktop with Network Level Authentication” option and also tried adding the local account under the ‘select users’ list, but am still getting the same error when trying with the local account.



Anyone know how to make this work with the local account?


Userlevel 5
Badge +4

Okay, that makes sense @AbhilashT .

Right, it has something to do with this Setting allow “remote connections to this computer”.


To be honest I am not sure if this will work with a local account. Is it working with the local admin account?


I think you should google about this issue and I am sure you would find something on this. :sweat_smile: