PowerShell to run script bypassing execution policy

PowerShellIn yesterday's article, I posted a script which can be used to download and delete files from a folder on an FTP site. When I tested it on one computer it worked fine, but on another it failed as the running of PowerShell is restricted. To avoid this error the PowerShell script can be saved to a file with a ps1 extension and then executed using the following (replace the highlighted section with your filename):

powershell -executionpolicy bypass -File "download files.ps1"

This will bypass the execution policy restricting the script from running and allow it to run without issue.

Can ISC Software Solutions help?

ISC Software Solutions are UK and Ireland based experts on Microsoft Dynamics GP. If you'd like to speak to someone about support, consultancy, upgrades, implementation, development, GP Elementz add-ons or portals, or anything else Dynamics GP related, you can use the form below.





Your Name (required):
Your Email (required):
Subject:
Enquiry message:

What should we write about next?





Your Name (required) -
Your Email (required) -

2 thoughts on “PowerShell to run script bypassing execution policy

Leave a Reply

Your email address will not be published. Required fields are marked *