Package PowerShell script in PowerShell Studio 2012

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 10 years and 8 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
bjorn80
Posts: 5
Last visit: Wed Jun 05, 2019 11:57 pm

Package PowerShell script in PowerShell Studio 2012

Post by bjorn80 »

Hi

I have a working Powershell Tool that i created in PowerShell Sudio 2012 for working with SharePoint.
If i choose to export the program to PowerShell and run the ps1 file on my sharePoint servers everything works fine.

However, when i try the fancy Package button to create an .exe file of my program, certain functions no longer work. An example of this being openfiledialogue, savefiledialogue. Nothing happens.

What do i have to consider when creating an exe-file through PowerShell studio?

Anyone else experienced this?

br

Bjorn
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Package PowerShell script in PowerShell Studio 2012

Post by jvierra »

Where are you getting these functions? If they are in your profile then you will need to load them explicitly in a package.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Package PowerShell script in PowerShell Studio 2012

Post by davidc »

Certain controls require STA mode. Make sure you package your GUI scripts using this option.

David
David
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Package PowerShell script in PowerShell Studio 2012

Post by Alexander Riedel »

Please make sure to post product questions in the product forum and not in the general PowerShell forum.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
bjorn80
Posts: 5
Last visit: Wed Jun 05, 2019 11:57 pm

Re: Package PowerShell script in PowerShell Studio 2012

Post by bjorn80 »

Hi thanks for replies!
The "Sta mode" is enabled allready.

So when i go ahead and create the exe package, my program goes to not responding then i have to force it to close.

All the code i am using is withing the script.
This is strange.

br

Bjorn
User avatar
bjorn80
Posts: 5
Last visit: Wed Jun 05, 2019 11:57 pm

Re: Package PowerShell script in PowerShell Studio 2012

Post by bjorn80 »

Duh... :shock:

Ok i put on STA mode in the package menu, then it worked :D
I thought i was only needed to be enabled on the standard "Home" tab..
Thanks!
This topic is 10 years and 8 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.