Running in Studio works, but built exe file do not

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Kenneth
Posts: 19
Joined: Sun Feb 26, 2012 9:30 pm

Running in Studio works, but built exe file do not

Post by Kenneth » Thu May 17, 2018 1:30 am

Product, version and build: Powershell studio 2018, 7.4.113
32 or 64 bit version of product: 64
Operating system: Win 10, Build 1709
32 or 64 bit OS: 64

Hi,

I have a project that I made a few years ago, and after making some minor modifications to it, i found that it won't run correctly in Powershell 3 and 5.

Is there any way of making Powershell Studio force the PS version used? If I run the exported PS1 file with parameter "-version 2" it works, but it is important for me to be able to use an exe file.

Best regards
Kenneth

User avatar
davidc
Posts: 5190
Joined: Thu Aug 18, 2011 4:56 am

Re: Running in Studio works, but built exe file do not

Post by davidc » Thu May 17, 2018 9:06 am

Do you get a specific error? I will need more details to understand what is happening, because scripts written for V2 will work in later versions of PowerShell without modifications (the exception maybe being PowerShell Core).

As for an exe file, you can always package a script using a PowerShell V2 engine.
When running the script in PowerShell Studio, you can select the V2 in the Ribbon->Home Tab->Platform:
V2 Platform.png
V2 Platform.png (20.5 KiB) Viewed 83 times
David
SAPIEN Technologies, Inc.