Use native engine in package scripts?

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
Locked
User avatar
mupdike
Posts: 27
Joined: Fri Jun 27, 2014 5:56 am

Use native engine in package scripts?

Post by mupdike »

Product, version and build: Primalscript 7.2.82
32 or 64 bit version of product: x64
Operating system: Win 8.1 x64
32 or 64 bit OS:

I am using the script packager for the first time and wanted to know if there's a way for my powershell script to be setup to use the target systems powershell engine based on the default architecture? So the exe will only call the powershell.exe on the machine and pass my .ps1 to it for execution.

Thanks for any help/advice.
Mike

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

Yes. Choose the "Microsoft Windows Powershell (Command line)" engine fitting your platform (x64 or Win32)
It will create a temporary file during execution though. Just so you are aware.
FYI, the SAPIEN PowerShell host engines also use the "native" powershell engine. They just do not use temporary files or powershell.exe
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
mupdike
Posts: 27
Joined: Fri Jun 27, 2014 5:56 am

Re: Use native engine in package scripts?

Post by mupdike »

In the Engine Type pull down it looks like I have to specifically select either the Win32 or x64 engine. I don't see a 'native' choice so that it would just use the engine for the architecture that the command is being run on. For an example if I write a .cmd file that says powershell.exe -command .\test.ps1 this will use the correct bitness powershell based on the architecture of the machine. I'm looking to replicate that in a more properly wrapped exe, if possible.

Thanks for the help!
Mike

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

Yeah, I guess that could be done. It would have to always be a 32 bit process.
I'll see what we can cook up.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

Add the engine in the attached zip file to your installation and see if that does what you want.
Attachments
Microsoft Windows PowerShell (Command line) Native.zip
(55.41 KiB) Downloaded 107 times
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
mupdike
Posts: 27
Joined: Fri Jun 27, 2014 5:56 am

Re: Use native engine in package scripts?

Post by mupdike »

Thanks for the exe, just getting that is incredible support. In attempting to test this I am getting an error of: 'Cannot run Script, error: The system cannot find the file specified. (image attached) Is this something I'm doing wrong? The .ps1 is in the same directory as the exe and the files the ps1 need (App-V related files).
Attachments
SapienPackagerExe-Error.png
SapienPackagerExe-Error.png (7.07 KiB) Viewed 4086 times

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

umm. Ok, let me check.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

Ok, try this one.
You do not need to deploy the script file with the exe, it is packaged inside.
Attachments
Microsoft Windows PowerShell (Command line) Native.zip
(55.05 KiB) Downloaded 112 times
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
mupdike
Posts: 27
Joined: Fri Jun 27, 2014 5:56 am

Re: Use native engine in package scripts?

Post by mupdike »

This worked perfectly! It imported the App-V Powershell cmdlet in the proper architecture on both x86 and AMD64 machines. Thank you very much for the assistance!

User avatar
Alexander Riedel
Posts: 7404
Joined: Tue May 29, 2007 4:43 pm

Re: Use native engine in package scripts?

Post by Alexander Riedel »

Glad to hear it. This will be part of the next service build.
Alexander Riedel
SAPIEN Technologies, Inc.

Locked