Inconsistent behaviour v2 vs v3 host

Use this forum to ask questions 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.
User avatar
akanoongo
Posts: 3
Joined: Mon Mar 12, 2018 7:02 am

Inconsistent behaviour v2 vs v3 host

Post by akanoongo » Mon Mar 12, 2018 7:15 am

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: 5534
Joined: Thu Aug 18, 2011 4:56 am

Re: Inconsistent behaviour v2 vs v3 host

Post by davidc » Mon Mar 12, 2018 8:38 am

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: 3
Joined: Mon Mar 12, 2018 7:02 am

Re: Inconsistent behaviour v2 vs v3 host

Post by akanoongo » Mon Mar 12, 2018 8:48 am

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: 5534
Joined: Thu Aug 18, 2011 4:56 am

Re: Inconsistent behaviour v2 vs v3 host

Post by davidc » Mon Mar 12, 2018 9:42 am

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: 3
Joined: Mon Mar 12, 2018 7:02 am

Re: Inconsistent behaviour v2 vs v3 host

Post by akanoongo » Mon Mar 12, 2018 8:48 pm

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: 6710
Joined: Tue May 29, 2007 4:43 pm

Re: Inconsistent behaviour v2 vs v3 host

Post by Alexander Riedel » Mon Mar 12, 2018 9:07 pm

"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.