Compiled .ps1 script to EXE not working.

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.
This topic is 8 years and 1 month 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
bgleason
Posts: 29
Last visit: Mon Oct 30, 2023 11:35 am
Been upvoted: 2 times

Compiled .ps1 script to EXE not working.

Post by bgleason »

Product, version and build: 4.2.99
32 or 64 bit version of product: 64bit
Operating system: Windows 8.1 Patched current
32 or 64 bit OS: 64bit

I have been working on a script and when I compile it, it appears to compile fine. It is adding an elevated Manifest regardless of what I select in the build settings.

I have tried with "Create an application without Manifest", "Embed a default Manifest", "Embed a default Manifest for elevation".

What I actually need is "Embed a default Manifest for elevation", but when I compile using that option or "Embed a default Manifest" I receive the following error message when trying to run the EXE.

It is a dialog box, first line is the pathto\exename.exe I ran followed by:
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
When I investigate the application event log, there is an error entry stating:
Activation context generation failed for "C:\Users\<UserNAME>\Documents\SAPIEN\Files\<EXEName>.exe".Error in manifest or policy file "C:\Users\<UserName>\Documents\SAPIEN\Files\<EXEName>.exe" on line 2. Invalid Xml syntax.
I obfuscated the username and exe name above.

I have also tried to build a .config file and without a .config file with no difference...

And finally, I can build a running exe if I select, "Create an application without Manifest", but again it defaults to an Admin Manifest, and I am still trying to find out why without specifying.

and even though that EXE runs successfully, after it runs I receive the following dialog box:
This program might not have installed correctly

If this program didn't install correctly, you can try installing the program using compatibility settings.

<Selectable option>Install using compatibility settings
<Selectable option>This program installed correctly
I can provide the script and/or any exe upon any Sapien request...

Please help...

Thanks,

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

Re: Compiled .ps1 script to EXE not working.

Post by Alexander Riedel »

Please see https://www.sapien.com/blog/2011/12/16/ ... n-my-icon/
If you get the elevation prompt without manifest and the install prompt you probably use something like 'install' or 'setup' in your exe name.
Windows treats executables with these strings in their names like installers and elevates automatically.

The side by side error and invalid xml usually stems from something you use in your exe name or the version information.
Try to use simple names and terms and see if that helps.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
bgleason
Posts: 29
Last visit: Mon Oct 30, 2023 11:35 am
Been upvoted: 2 times

Re: Compiled .ps1 script to EXE not working.

Post by bgleason »

Thanks for the quick reply... Yeah I recall that "Install" being in the filename now from something else I worked on years ago, not PS related, but just how it prompted for creds or the like just from Install being in the name. Thanks for this reminder... Blah

And you were correct on the second piece as well... There was a valid special character in the name as far as NTFS sees it, but obviously PSStudio does not... Removed the special character and all is good...

I am working again and thanks!!!

Brian
This topic is 8 years and 1 month 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.