# Powershell Script execution not recieving data from included files

**URL:** <https://discourse.nodered.org/t/powershell-script-execution-not-recieving-data-from-included-files/41737>\
**Category:** General\
**Created:** [28 February 2021 02:28 UTC](https://discourse.nodered.org/t/powershell-script-execution-not-recieving-data-from-included-files/41737 "2021-02-28T02:28:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozdeadmeat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ozdeadmeat/32/37983_2.png) [@ozdeadmeat](https://discourse.nodered.org/u/ozdeadmeat)\
**Post date:** [28 February 2021 02:28 UTC](https://discourse.nodered.org/t/powershell-script-execution-not-recieving-data-from-included-files/41737/1 "2021-02-28T02:28:13Z")

</div>

I am trying to use Node red to execute a script with another script included within it. When I put the data into the one script file, it works as intended. When I call the external file with a . .\file.ps1 include it does not appear to load the data from other file. Is this a feature? If so, how do i disable it.

---

<div class="post-metadata">

**Author:** ![ozdeadmeat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ozdeadmeat/32/37983_2.png) [@ozdeadmeat](https://discourse.nodered.org/u/ozdeadmeat)\
**Post date:** [28 February 2021 03:05 UTC](https://discourse.nodered.org/t/powershell-script-execution-not-recieving-data-from-included-files/41737/2 "2021-02-28T03:05:17Z")

</div>

Solved my own problem. When Node-red (and any other command method i assume) executes a powershell script (external to powershell CLI itself) it utilizes the "C:\Windows\System32" folder as the working folder.

The work around is to stipulate the -path you want to work within as an argument within the powershell.exe command call.

so in your script have a param called "$ScriptDIR" or something and then call the script with a -ScriptDIR "c:\diryouwant" and your done.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 March 2021 03:06 UTC](https://discourse.nodered.org/t/powershell-script-execution-not-recieving-data-from-included-files/41737/3 "2021-03-14T03:06:05Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
