UnauthorizedAccess Error while Setting up ESB Exception Handling Sample code in BizTalk 2013

When I was trying to setup the ESB exception handling using the setup_bin.cmd file, I got the error UnauthorizedAccess. I was getting this error even when I ran the cmd file in administrator mode.

The error says

C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\ESBSource\Source\Samples\Exception Handling
\Install\Scripts>powershell .\ExceptionHandling_Install.ps1 1.\ExceptionHandling_Install.ps1:
File C:\Program Files (x86)\Microsoft BizTalk ESBToolkit\ESBSource\Source\Samples\ExceptionHandling\Install\Scripts\ExceptionHandling_Install.ps1 cannot be loaded because running scripts is disabled on this system.

At line:1 char:1 
 .\ExceptionHandling_Install.ps1 1
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException 
    + FullyQualifiedErrorId : Unauthorized Access

The reason was the powershell didn’t have enough access to execute the cmdlets present in ExceptionHandling_Install.ps1.
so I ran the cmd set-executionpolicy unrestricted in the windows powershell, but even after providing the unrestricted access to the powershell still I was facing the same issue as before.
After some more analysis, I figured out that some of the cmdlets runs in x86 powershell. Ran the cmd set-executionpolicy unrestricted in windows powershell x86 which solved the issue.

To figure out if just setting the unrestricted access in x86, I removed the unrestricted access in x64 powershell and re run my setup file, and ran into same error as earlier. 
So the takeaway is, execute the cmd in both x64 and x86 powershell to resolve the above error when setting up ESB exception handling.

Happy Biztalking!!

Written by
Shashidharan Krishnan

Reviewed by
Jainath V R

Microsoft India GTSC

Comments (0)