Inconsistent behaviour v2 vs v3 host

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
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.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
akanoongo
Posts: 6
Last visit: Tue Jun 15, 2021 10:04 pm

Inconsistent behaviour v2 vs v3 host

Post by akanoongo »

Product, version and build:
32 or 64 bit version of product: 64 bit
Operating system: W7
32 or 64 bit OS: 64 Bit

Hello

I was testing trial version and noticed some strange behaviour for following code.
Param
(
[Parameter(Mandatory=$true)]
[int] $Commit
)

If compiled engine type as V2 Host command line, above code works most of the users, but for some others users it wont work. It wont take parameter automatically. Most of the users are having PS version 3.0 and above.

I am running exe as
script.exe -commit 0 or script.exe -commit 1

When I compile exe with V3 host, it works for those users who are facing issue.

Should I compile exe with V3 host for all the users? Will it support?

BTW, will V3 host support PS version 3.0 and 2.0?

PLease advise
AK
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Inconsistent behaviour v2 vs v3 host

Post by davidc »

I'm not sure what you mean by "wont take parameter automatically". Are they getting an error message?

The PowerShell V3 engines will not work in V2 only environment. For those users, you will need to create a separate V2 executable. But the V3 engines should work in machines that have V4 and V5 installed.

This article also lists the necessary prerequisites for the packager engines:

https://info.sapien.com/index.php/packa ... requisites
David
SAPIEN Technologies, Inc.
User avatar
akanoongo
Posts: 6
Last visit: Tue Jun 15, 2021 10:04 pm

Re: Inconsistent behaviour v2 vs v3 host

Post by akanoongo »

I have to pass parameter 0 or 1 as it is mandatory. I tried the exe manually as script.exe -commit 0 or script.exe -commit 1. It is not validating 0 or 1. Then I executed script.exe, it is still not asking for enter any value. As I mentioned If I compile as V3 host command of PrimalScript application. It works, is there any PowerShell environment related issue or version limitation. I tested on user has PpowerShell V5 is installed but no luck. However I run the actual script, it works.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Inconsistent behaviour v2 vs v3 host

Post by davidc »

We have been unable to reproduce this so far. We are prompted when if we don't specify a mandatory parameter in the command line.

I have a few more questions:

1. Are you using PrimalScript or PowerShell Studio? And what is the exact build?
2. What OS does the V5 machine have installed?
3. What platform did you select for the executable? X86 or 64 bit?
4. How are you calling the executable? From a PowerShell console? Batch file?

Can you zip and upload your script here (include the psbuild file)?

https://www.sapien.com/support/upload

Thank you
David
SAPIEN Technologies, Inc.
User avatar
akanoongo
Posts: 6
Last visit: Tue Jun 15, 2021 10:04 pm

Re: Inconsistent behaviour v2 vs v3 host

Post by akanoongo »

Hi Davidc,
I am using Primal Script. Tested on W7 and W10 64 Bit machines. I am calling exe from batch files.

As I mentioned earlier, I tried to run the exe as well, but no luck.

Let me know if you need any more information.

AK
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Inconsistent behaviour v2 vs v3 host

Post by Alexander Riedel »

"I tried to run the exe as well, but no luck" Please remember that we cannot see your screen. In this statement we do not know what "run the exe" means as to for which version you packaged and "no luck" is not a real PowerShell error message. The more precise you describe your environment and the events, the easier it for us to help you.
In general you should ALWAYS package for the PowerShell version that is in use on the machine in question. If you package for V2 and run that on a V5 machine, the PowerShell engine merely emulates PowerShell V2. It will behave differently than running on a real V2 installation.
It is not clear from your description if you actually need to package for PowerShell V2. This would be a rather old machine and should be upgraded to a later PowerShell version anyway, it at all possible.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.