# ReadAllBytes in Powershell Snapin hangs when called from FinalBuilder

**URL:** https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194
**Category:** Discussion
**Created:** [September 9, 2013, 11:13am UTC](https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194 "2013-09-09T11:13:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![matttrinder](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@matttrinder](https://www.finalbuilder.com/forums/u/matttrinder)
#### Post date: [September 9, 2013, 11:13am UTC](https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194/1 "2013-09-09T11:13:20Z")

</div>

Hi

We have developed a powershell snap-in which calls the C# ReadAllBytes function to read a file into a byte array.&nbsp; This has been tested and works correctly when run from a powershell script.

However, when we try and run the same powershell script using a FB "Execute Powershell Script" component, that process hangs at this point.

&nbsp;Any ideas what could be causing this ?

&nbsp;

Thanks

Matt

---

<div class="post-metadata">

### Author: ![matttrinder](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@matttrinder](https://www.finalbuilder.com/forums/u/matttrinder)
#### Post date: [September 9, 2013, 12:16pm UTC](https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194/2 "2013-09-09T12:16:37Z")

</div>

Actually we have got around this issue by moving the line of code (not sure why this would work but may be related to the issue we have now…)   
  
 We are now making a call to a Dynamics CRM webservice, and again the script hangs at this point. The CRM webserver does not appear to receive the call.   
 Just to re-iterate, these calls all work perfectly when called in a powershell script outside of FB (on the same machine - it’s the same script…) but do not function correctly when called from within FB.   
  
 Are there any security implications or anything similar we need to be aware of when executing PS scripts from Final Builder…?   
  
 Thanks   
  
 Matt

---

<div class="post-metadata">

### Author: ![matttrinder](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@matttrinder](https://www.finalbuilder.com/forums/u/matttrinder)
#### Post date: [September 9, 2013, 12:23pm UTC](https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194/3 "2013-09-09T12:23:30Z")

</div>

More information - running the ps scripts from a FB “Dos Command” using the following command   
 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe “C:\Users\administrator.TISSKIDEV\Documents\untitled1.ps1”   
 also works correctly - it’s just calling it from the FB “Execute Powershell Script” which has the issue…   
  
 TIA   
  
 Matt

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 9, 2013, 12:28pm UTC](https://www.finalbuilder.com/forums/t/readallbytes-in-powershell-snapin-hangs-when-called-from-finalbuilder/2194/4 "2013-09-09T12:28:13Z")

</div>

My guess is this is a security issue and powershell is prompting for input (which finalbuilder doesn’t see). What is your execution policy set to :   
  
 [http://technet.microsoft.com/en-us/library/ee176961.aspx](http://technet.microsoft.com/en-us/library/ee176961.aspx)
