# Powershell script failing when run in playbook - works on other servers and runs ok manually on target host - cannot find path

**URL:** <https://forum.ansible.com/t/powershell-script-failing-when-run-in-playbook-works-on-other-servers-and-runs-ok-manually-on-target-host-cannot-find-path/27553>\
**Category:** Ansible Project\
**Created:** [May 18, 2018, 12:05am UTC](https://forum.ansible.com/t/powershell-script-failing-when-run-in-playbook-works-on-other-servers-and-runs-ok-manually-on-target-host-cannot-find-path/27553 "2018-05-18T00:05:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_Drew](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@Lee\_Drew](https://forum.ansible.com/u/Lee_Drew)\
**Post date:** [May 18, 2018, 12:05am UTC](https://forum.ansible.com/t/powershell-script-failing-when-run-in-playbook-works-on-other-servers-and-runs-ok-manually-on-target-host-cannot-find-path/27553/1 "2018-05-18T00:05:15Z")

</div>

The play copies a powershell script and runs it on the target - the script looks up files in C:\Temp. This path definitely exists.

I can run this play without issues against other test servers - now that I want to run this play on the actual server I want to configure I get the below error…

fatal: [servername]: FAILED! =\> {“changed”: true, “msg”: “non-zero return code”, “rc”: 1, “stderr”: "Get-ChildItem : Cannot find path ‘C:\Temp’ because it does not exist.\r\nAt C:\Users.…

Running the same Powershell script locally on the target server returns a json file - no errors thrown.

WinRM config etc is all ok.

Let me know if you need more info…

Thanks!

---

<div class="post-metadata">

**Author:** ![Lee\_Drew](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@Lee\_Drew](https://forum.ansible.com/u/Lee_Drew)\
**Post date:** [May 18, 2018, 1:09am UTC](https://forum.ansible.com/t/powershell-script-failing-when-run-in-playbook-works-on-other-servers-and-runs-ok-manually-on-target-host-cannot-find-path/27553/2 "2018-05-18T01:09:45Z")

</div>

OK - issue resolved… was targeting wrong server in inventory file!
