This project is read-only.

STA Mode

Mar 8, 2013 at 8:24 PM
Hi,
Thanks for this great script!
I need to compile a PS script in an exe, but I need it run Powershell in STA mode...
Is there a way to do this??

Thanks,
Mar 9, 2013 at 10:15 AM
Hi Ingo,

Found the solution...

I've added the following code:
myRunSpace.ApartmentState = System.Threading.ApartmentState.STA;
myRunSpace.ThreadOptions = PSThreadOptions.ReuseThread;
on line 754, just before myRunSpace.Open();

Rob.
Mar 9, 2013 at 1:08 PM
see v0.4... :-)

redpark wrote:
Hi Ingo,

Found the solution...

I've added the following code:
myRunSpace.ApartmentState = System.Threading.ApartmentState.STA;
myRunSpace.ThreadOptions = PSThreadOptions.ReuseThread;
on line 754, just before myRunSpace.Open();

Rob.
Mar 9, 2013 at 5:53 PM
Edited Mar 9, 2013 at 5:53 PM
Hi Ingo,

Thanks for the extra options - very helpful.
I'm afraid that this one doesn't compile for me - multiple errors.

Image

Rob.
Mar 9, 2013 at 7:44 PM
I've fixed it. Please test again... Thanks!

redpark wrote:
Hi Ingo,

Thanks for the extra options - very helpful.
I'm afraid that this one doesn't compile for me - multiple errors.

Image

Rob.
Mar 9, 2013 at 9:32 PM
Will do...

The download doesn't seem to be available just yet... I'll try again tomorrow!
Mar 9, 2013 at 10:21 PM
There was an problem during the upload... now v0.4 is online.
redpark wrote:
Will do...

The download doesn't seem to be available just yet... I'll try again tomorrow!
Mar 9, 2013 at 11:18 PM
Looks great now and compiles my STA required script perfectly.

Many thanks Ingo!
Mar 9, 2013 at 11:35 PM
Edited Mar 9, 2013 at 11:37 PM
Glad to hear! :-)

Regards
Ingo