Complied exe file 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 5 years and 4 months 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
barnold08
Posts: 22
Last visit: Fri Sep 02, 2022 11:36 am

Complied exe file not working

Post by barnold08 »

Product, version and build: PowerShell Studio 2018 build 5.5.155
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 Enterprise
32 or 64 bit OS: 64 bit

I have a multi-form GUI project that is saved in Program Files. The project imports the ActiveDirectory module, and loads a combo box with results from a Get-ADComputer command. If I run PS Studio as an Admin, everything works great while in the PSS editor. When I compile that project into an exe file and run the exe as an Admin, the main form loads, but the combo box does not populate. The project is compiled using the SAPIEN PowerShell v2 Host (Windows Forms) script engine. I feel this is a symptom of a larger problem. Is there a log file or logs in the Event Viewer that might help track down the breakdown? It *shouldn't* be a permissions issue. Thanks in advance!
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Complied exe file not working

Post by davidc »

When you run the script in PowerShell Studio, what PowerShell version / platform (x64 or x86) are you using? Make sure your selected package engine matches the settings in PowerShell Studio.

Note: The Windows Form engines suppresses all output. Try using a Commandline engine for debugging, so that any output or errors will appear in the console window.
David
SAPIEN Technologies, Inc.
User avatar
barnold08
Posts: 22
Last visit: Fri Sep 02, 2022 11:36 am

Re: Complied exe file not working

Post by barnold08 »

Ah, thank you. Compiling using the Commandline engine pointed me the right direction. I was using $PSScriptRoot to read an xml file in the same folder as the exe. Once I changed the variable to $ScriptDirectory everything started working as expected! Thanks again!
This topic is 5 years and 4 months 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.